2013-03-19 14 views
28

Come risolvere questo errore alla fine?Errore server IIS a causa della memoria totale corrente


Server Error in '/ **** StatWCF_OData' applicazione. Errore

Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InsufficientMemoryException: Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element. 

Fonte:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

dello stack:

[InsufficientMemoryException: Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.] 
    System.ServiceModel.Activation.ServiceMemoryGates.Check(Int32 minFreeMemoryPercentage, Boolean throwOnLowMemory, UInt64& availableMemoryBytes) +121924 
    System.ServiceModel.HostingManager.CheckMemoryCloseIdleServices(EventTraceActivity eventTraceActivity) +86 
    System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +883 

[ServiceActivationException: The service '/****StatWCF_OData/OData.svc' cannot be activated due to an exception during compilation. The exception message is: Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element..] 
    System.Runtime.AsyncResult.End(IAsyncResult result) +650220 
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +210733 
    System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282 

Informazioni sulla versione: Microsoft .NET Framework versione: 4.0.30319; Versione ASP.NET: 4.0.30319.17929

risposta

82

La soluzione è scritta nel tuo messaggio.

To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.

Il modo più semplice è sufficiente aggiungere questo nel tuo web.config

<system.serviceModel> 
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" /> 
</system.serviceModel> 

Per saperne di più serviceHostingEnvironmenthere.

Comunque, come @Mr Grok ha puntato correttamente, è un'indicazione che la vostra macchina non ha abbastanza memoria fisica e dovreste capire perché sta succedendo. Può essere un problema serio.

+10

Anche se questo sarebbe il più semplice, vale la pena notare che se il tuo server è dotato di risorse, questo errore potrebbe essere un'indicazione che non hai davvero abbastanza memoria fisica sulla macchina in modo da poter essere vicino ad avere un problema più grande sulle tue mani Vale la pena controllare il monitor delle risorse/il task manager per vedere quanta memoria è in uso. –

+2

Ti chiedi perché non ~ 2% anziché 0%? Con 0%, non mette tutti i processi (possibilmente critici) sul server in pericolo di allocazione fallita (eventualmente non gestita)? Oh "memoria libera" non include virtuale (guardando il task manager che mostra free = 0 con commit = 8/13)? Qualcuno può confermare? – crokusek

5

Ho avuto questo problema. Risulta che il server SQL utilizzava oltre 29 GB dei miei 32 gb disponibili.

Controlla il tuo server SQL se ne hai uno. MS SQL Sever è progettato per occupare tutto lo spazio libero consentito. È possibile limitare questo limite nella casella di memoria massima del server nelle schede delle proprietà di SQL Server.

0

Ho aggiunto l'attributo serviceHostingEnvironment a 0 in web.config.

<system.serviceModel> 
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" /> 
</system.serviceModel> 

Questo è il modo più semplice che ho trovato di fare questo.

Problemi correlati