2013-03-19 8 views
28

Jak ostatecznie rozwiązać ten błąd?Błąd serwera IIS z powodu bieżącej pamięci całkowitej


Błąd serwera w aplikacji "/ **** StatWCF_OData".

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. 

Błąd Źródło:

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. 

stosu Ślad:

[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 

Informacja Wersja: Microsoft .NET Framework w wersji: 4.0.30319; Wersja ASP.NET: 4.0.30319.17929

Odpowiedz

82

Rozwiązanie jest napisane w twoim poście.

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

Najłatwiej po prostu dodać to do swojego web.config

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

Czytaj więcej o serviceHostingEnvironmenthere.

W każdym razie, jak @Mr Grok prawidłowo wskazywał, że oznacza to, że twój komputer nie ma wystarczającej ilości fizycznej pamięci i powinieneś dowiedzieć się, dlaczego tak się dzieje. To może być poważny problem.

+10

Choć byłoby to najłatwiejsze, warto zauważyć, że jeśli serwer ma ograniczone zasoby, ten błąd może wskazywać, że na maszynie nie ma wystarczającej ilości fizycznej pamięci, aby można było zbliżyć się do większego problemu na twoich rękach. Byłoby warto sprawdzić monitor zasobów/menedżer zadań, aby zobaczyć, ile pamięci jest w użyciu. –

+2

Zastanawiasz się, dlaczego nie ~ 2% zamiast 0%? Przy 0%, czy nie kładzie każdego procesu (prawdopodobnie krytycznego) na serwerze w niebezpieczeństwie nieudanego przydziału (być może nieobsługiwanego)? "Wolna pamięć" nie obejmuje wirtualnego (patrząc na menedżer zadań pokazujący free = 0 z commitem = 8/13)? Czy ktoś może potwierdzić? – crokusek

5

Miałem ten problem. Okazało się, że serwer SQL używał ponad 29 GB moich dostępnych 32 GB.

Sprawdź swój serwer SQL, jeśli taki posiadasz. MS SQL Sever został zaprojektowany tak, aby zajmował tyle wolnej przestrzeni, ile na to pozwalasz. Możesz to ograniczyć w polu maksymalnej pamięci serwera w zakładkach właściwości serwera SQL Server.

0

Dodałem atrybut serviceHostingEnvironment do 0 w pliku web.config.

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

To najsmuklejszy sposób, w jaki udało mi się to zrobić.

Powiązane problemy