Troubleshooting “An unexpected error occurred” message when using Remote Web Access to connect to computers

[This post comes to us courtesy of Manish Kapoor from Commercial Technical Support]

We occasionally come across scenarios where memory consumption on an SBS Server increases and this may cause the server to run slow. Additionally, some of the services/features may stop working correctly.

You may find that trying to connect to computers or accessing shares from within RWA may fail with an error message similar to the one below:

clip_image001

Another symptom might be that you try clicking on a gadget in RWA and nothing happens.

If you check the event logs, you will find this warning:

Log Name: Application
Source: ASP.NET 4.0.30319.0
Date: 9/17/2013 15:31:28
Event ID: 1309
Task Category: Web Event
Level: Warning
Keywords: Classic
User: N/A
Computer: SBS.Contoso.local
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 9/17/2013 15:31:28 Event time (UTC): 9/17/2013 13:31:28 Event ID: 401c8120945a4115abb39de75d347aba
Event sequence: 5
Event occurrence: 1
Event detail code: 0

Application information:

Application domain: /LM/W3SVC/1/ROOT/Remote-1-130099878420126008
Trust level: Full
Application Virtual Path: /Remote
Application Path: C:\Program Files\Windows Small Business Server\Bin\WebApp\RemoteAccess\
Machine name: SBS

Process information:

Process ID: 5100
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Exception information:

Exception type: InsufficientMemoryException
Exception message: Memory gates checking failed because the free memory (369917952 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)

There could be multiple contributors to the above problem. If you have applied .NET Framework 4.5.1 recently, you can work around this issue by modifying the Remote Web Access web.config file using the following steps: 

  • Open web.config file located at: “%ProgramFiles%\Windows Small Business Server\Bin\WebApp\RemoteAccess”.
  • Search in Web.config for "<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />", change this line to "<serviceHostingEnvironment aspNetCompatibilityEnabled="true" minFreeMemoryPercentageToActivateService="0" />"
  • Save changes and close the file.
  • Run IISRESET from an elevated Command Prompt window

For more details on the root cause, information is available here: https://msdn.microsoft.com/en-us/vstudio/dn458357(v=vs.98).aspx.

You should not uninstall any versions of the .NET Framework that are installed on your computer, because an application in use may depend on a specific version of the .NET Framework. For more information, see The .NET Framework for Users in the Getting Started guide.

Note: If you don't have .NET Framework 4.5.1 installed and are still running in the issue described above, you may need to analyze the memory usage of different processes running on the server and fine tune them. In such a scenario, normal performance troubleshooting steps apply. Capturing a Performance Monitor log and comparing it with baseline performance throughput should be the right way to move forward.