Corrupt .NET Cache Causing HTTP Error 500 and Event Log entries

Version 1

    Verified Product Versions

    AppSense Environment Manager 8.6AppSense Environment Manager 8.5AppSense Environment Manager 8.4AppSense Environment Manager 8.3AppSense Environment Manager 8.2AppSense Environment Manager 8.1AppSense Environment Manager 8.0AppSense Management Center 8.6AppSense Management Center 8.5AppSense Management Center 8.4AppSense Management Center 8.3AppSense Management Center 8.2AppSense Management Center 8.1AppSense Management Center 8.0AppSense Management Center 8.7

    Introduction

    When accessing resources in a website you could receive an error 500 in the IIS logs.

    This is also met with Event Log entries and, if using a web browser, you could see an error page.

    Browser Web Page 

    Server Error in '/PersonalizationServer' Application.
    Could not load file or assembly 'ExceptionHandling' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
    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.IO.FileLoadException: Could not load file or assembly 'ExceptionHandling' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

    Environment Manager Console (when connecting to Personalization Server)

    (500) Internal Server Error
       at EMConsole.Objects.ObjectManager.ExecuteBackgroundWorker(String name, Object[] parameters)
       at EMConsole.Objects.ObjectManager.ContactDatabase()
       at EMConsole.Controllers.ProfileNavBarController.ConnectToServer(ServerInfo serverInfo)
       at EMConsole.Controllers.ProfileNavBarController.OnConnect(Object sender, EventArgs e)

    Event Log

    • Source: ASP.NET 4.0.30319.0
    • Event ID: 1310

    Event Details

    Event code: 3008
    Event message: A configuration error has occurred.
    Event time: 13/04/2013 04:18:30
    Event time (UTC): 13/04/2013 03:18:30
    Event ID: d960d794e31e415aa0ac142a9ff52104
    Event sequence: 1
    Event occurrence: 1
    Event detail code: 0 

    Application information: 
        Application domain: /LM/W3SVC/1/ROOT/PersonalizationServer-5-130102967102678293 
        Trust level: Full 
        Application Virtual Path: /PersonalizationServer 
        Application Path: C:\Program Files\AppSense\Environment Manager\Personalization Server\ 
        Machine name: GB-AMS-NLB-01

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

    Exception information: 
        Exception type: ConfigurationErrorsException 
        Exception message: Could not load file or assembly 'ExceptionHandling, Version=10.5.33.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
       at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
       at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
       at System.Web.Configuration.AssemblyInfo.get_AssemblyInternal()
       at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
      at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
       at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
    Could not load file or assembly 'ExceptionHandling, Version=10.5.33.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
       at System.Reflection.Assembly.Load(String assemblyString)
       at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
    Could not load file or assembly 'ExceptionHandling' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

    Request information: 
        Request URL: http://localhost/PersonalizationServer/status.aspx 
        Request path: /PersonalizationServer/status.aspx 
        User host address: ::1 
        User: 
       Is authenticated: False 
        Authentication Type:  
        Thread account name: NT AUTHORITY\NETWORK SERVICE

    Thread information: 
        Thread ID: 8 
        Thread account name: NT AUTHORITY\NETWORK SERVICE 
        Is impersonating: False 
        Stack trace:
            at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
            at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
            at System.Web.Configuration.AssemblyInfo.get_AssemblyInternal()
            at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
            at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
            at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

    Detail

    Delete the contents of following directory from the affected IIS server:

    • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

    If you are unable to delete the folder then an IISRESET from an elevated Command Prompt should release the handle on the folder.

    The folder is then recreated on first contact to the website again.

    NOTE: This also works for other versions of .NET.