Troubleshoot exceptions in ASP.NET applications

Troubleshooting steps when there is an exception while monitoring ASP .NET applications.

Use Case:

Sometimes, you may receive the exception "Loading this assembly would produce a different grant set from other instances.", while running the APM Insight .NET agent in your ASP .NET applications.
This is because, by design, the agent works by modifying the IL code at runtime. Hence, it is required to run the application in full trust environments and in single domain mode. 

Solution
Follow the below steps to resolve the exception:
  1. Add   <trust level =”Full”/>    under the block in the application web.config file. In most cases, this will resolve the issue. If the issue is not resolved with this step, proceed to the next step.
  2. Set loader optimization to single domain mode. [Note: This second step is not recommended for Share Point applications.]
    • For 64 bit applications:
      1. Open Registry Editor and navigate to the below path, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework" 
      2. Create a new registry DWORD value called "LoaderOptimization" and set the value as 1.
    • For 32 bit applications:
      1. Open Registry Editor and navigate to the below path, "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework"
      2. Create a new registry DWORD value called "LoaderOptimization" and set the value as 1.
  3. Reset IIS and access your application. 


    • Related Articles

    • FAQs related to Windows Service monitoring

      After installing APM Insight Windows service monitoring agent , if you don't see data in the Site24x7 console, or if you are unable to add monitors, kindly follow the below given steps to troubleshoot. If few monitors are not getting added: Check for ...
    • How to add APM Insight Java agent without application restart?

      In general, after installing the APM Insight Java agent, you have to restart your application for the agent to capture monitoring data.   But in case of critical issues in the app, like sudden application slowness, where you haven't installed APM ...
    • APM Insight agent log paths

      Folder path to view One agent logs One agent logs can be found only in the common application folder in Windows (usually under C:\ProgramData from Vista onwards). Check the following folder path in Windows: C:\ProgramData\Site24x7APMOneAgent\Logs  ...
    • What does Java agent troubleshooting operation do and what are the additional arguments that can be given?

      Troubleshooting operation will perform the below mentioned checks: Checks whether agent directory has read/write operations Checks whether apminsight.conf has license key mentioned Checks whether agent state, unmanaged, deleted or managed Checks ...
    • How to rename an APM Insight application?

      Site24x7 APM Insight doesn't support renaming applications/monitors from the web client. However, the application name of an existing application instance can be renamed in the apminsight.conf file and the agent associated with that instance will ...