locked
IIS Headaches RRS feed

  • Question

  • Hi,

    We've recently rewritten our lightswitch app from scratch in LS2012 and everything seemed fine. However, 2 or 3 times a day we are now getting these error's in IIS which are visible in the event log viewer on our server. If the user is in the app they start to get errors when pulling or posting data. When they try to relaunch the app, they just get the blank app screen with new menu.

    The problem is easily rectified by dropping to a command prompt on the server and running 'iisreset'. As soon as IIS has finished restarting, the app responds and works perfectly again. I can't seem to put any sort of consistency to it which is most annoying though.

    The exception error talks about "Exception type: InsufficientMemoryException". No whilst I don't want to instantly dismiss the exception, this server is a HP ProLiant Server running Quad Xeon's and 12GB RAM. It only serves around 10 machines.

    Has anyone else experienced such problems?

    Paul.

    Errors:

    This is a warning in ASP.NET 4.0.30319.0 Web Event

    Event code: 3005 
    Event message: An unhandled exception has occurred. 
    Event time: 28/11/2012 21:03:06 
    Event time (UTC): 28/11/2012 21:03:06 
    Event ID: a77f48e62dfe440292912a1cc89f5a88 
    Event sequence: 10 
    Event occurrence: 1 
    Event detail code: 0 
     
    Application information: 
        Application domain: /LM/W3SVC/1/ROOT/MansfieldAnodisers2012-3-129986101608859223 
        Trust level: Full 
        Application Virtual Path: /MansfieldAnodisers2012 
        Application Path: C:\inetpub\wwwroot\MansfieldAnodisers2012\ 
        Machine name: SERVER 
     
    Process information: 
        Process ID: 1888 
        Process name: w3wp.exe 
        Account name: IIS APPPOOL\DefaultAppPool 
     
    Exception information: 
        Exception type: InsufficientMemoryException 
        Exception message: Memory gates checking failed because the free memory (258449408 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.
       at System.ServiceModel.Activation.ServiceMemoryGates.Check(Int32 minFreeMemoryPercentage, Boolean throwOnLowMemory, UInt64& availableMemoryBytes)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CheckMemoryCloseIdleServices(EventTraceActivity eventTraceActivity)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)

     
     
    Request information: 
        Request URL: http://server/MansfieldAnodisers2012/Services/Microsoft-LightSwitch-Security-ServerGenerated-Implementation-AuthenticationService.svc/binary/GetAuthenticationInfo 
        Request path: /MansfieldAnodisers2012/Services/Microsoft-LightSwitch-Security-ServerGenerated-Implementation-AuthenticationService.svc/binary/GetAuthenticationInfo 
        User host address: 192.168.0.250 
        User:  
        Is authenticated: False 
        Authentication Type:  
        Thread account name: ANODISERS\Administrator 
     
    Thread information: 
        Thread ID: 46 
        Thread account name: ANODISERS\Administrator 
        Is impersonating: False 
        Stack trace:    at System.ServiceModel.Activation.ServiceMemoryGates.Check(Int32 minFreeMemoryPercentage, Boolean throwOnLowMemory, UInt64& availableMemoryBytes)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CheckMemoryCloseIdleServices(EventTraceActivity eventTraceActivity)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
     

    ===============================================================

    This is an error in System.ServiceModel 4.0.0.0 WebHost

    WebHost failed to process a request.
     Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/22193252
     Exception: System.ServiceModel.ServiceActivationException: The service '/MansfieldAnodisers2012/Services/Microsoft-LightSwitch-Security-ServerGenerated-Implementation-AuthenticationService.svc' cannot be activated due to an exception during compilation.  The exception message is: Memory gates checking failed because the free memory (204238848 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.InsufficientMemoryException: Memory gates checking failed because the free memory (204238848 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.
       at System.ServiceModel.Activation.ServiceMemoryGates.Check(Int32 minFreeMemoryPercentage, Boolean throwOnLowMemory, UInt64& availableMemoryBytes)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CheckMemoryCloseIdleServices(EventTraceActivity eventTraceActivity)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
       --- End of inner exception stack trace ---
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
       at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
     Process Name: w3wp
     Process ID: 1888

    • Edited by Paul Pitchford Wednesday, November 28, 2012 9:23 PM Added errors
    Wednesday, November 28, 2012 9:21 PM

Answers

  • The error is exactly as it described in the message.  If you check your server at the time this error starts, you should see that the free memory on that machine is less than 5% of the total RAM.  I run into this problem frequently on my dev box, where I have 16GB of RAM (using 12 GB for virtual machines, have a SQL server running, etc...).  Once I hit 15.2 GB of memory usage this error will occur.

    I address it by adjusting the web.config setting that is listed in the error message, adding the final attribute listed below (the others are already in the web.config).  That works on my dev box, but I would suggest you check what processes are running on your web server to see where the high usage is coming from.  If you are running SQL Server on that same machine, I would suggest setting the "Maximimum server memory" setting (under the Memory settings in SQL Server Properties)

    <serviceHostingEnvironment
     aspNetCompatibilityEnabled="true" 
     multipleSiteBindingsEnabled="true"  
     minFreeMemoryPercentageToActivateService="1"/>


    David Kidder | Senior SDET | Microsoft | LightSwitch

    Friday, November 30, 2012 3:46 PM
    Moderator

All replies

  • Hi Paul,

    can you check the memory consumption of the server? What processes are using how much memory?

    I would think that the error is not an error. In your configuration you have a setting, that deactivates the WCF Service of your LightSwitch Application in case there is not enough free memory.

    A typical szenario for such an error could be an busy SQL Server running on the same system (which can use all the RAM and if other applications need more RAM it can quickly release part of the cache). But a check of the processes could help and explain it.

    That is how I would interpret the error message that you posted. You could also check the following thread in an ASP.Net forum: http://forums.asp.net/t/1759880.aspx/1

    With kind regards,

    Konrad

    Thursday, November 29, 2012 3:05 PM
  • The error is exactly as it described in the message.  If you check your server at the time this error starts, you should see that the free memory on that machine is less than 5% of the total RAM.  I run into this problem frequently on my dev box, where I have 16GB of RAM (using 12 GB for virtual machines, have a SQL server running, etc...).  Once I hit 15.2 GB of memory usage this error will occur.

    I address it by adjusting the web.config setting that is listed in the error message, adding the final attribute listed below (the others are already in the web.config).  That works on my dev box, but I would suggest you check what processes are running on your web server to see where the high usage is coming from.  If you are running SQL Server on that same machine, I would suggest setting the "Maximimum server memory" setting (under the Memory settings in SQL Server Properties)

    <serviceHostingEnvironment
     aspNetCompatibilityEnabled="true" 
     multipleSiteBindingsEnabled="true"  
     minFreeMemoryPercentageToActivateService="1"/>


    David Kidder | Senior SDET | Microsoft | LightSwitch

    Friday, November 30, 2012 3:46 PM
    Moderator
  • Thanks gents, 

    The:

    minFreeMemoryPercentageToActivateService="1"

    Seems to be doing the trick!

    Thanks,

    Paul.

    Monday, December 3, 2012 3:39 PM