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

    • How to enable or disable application filters in the .NET Core agent?

      The APM Insight .NET Core agent is designed to monitor IIS-hosted applications based on the list entered in the appfilter.config file in the agent's installation location. Irrespective of the filter, we can monitor all .NET Core applications hosted ...
    • How to verify the license key for a .NET application

      Problem Statement: The APM Insight .NET monitor is not created in the Site24x7 web client because of an empty or invalid license key. Prerequisite: The Site24x7 APM Insight .NET agent should be installed. Steps to verify the license key Navigate to ...
    • 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 ...
    • How to identify and resolve conflicts between other APM products and the APM Insight .NET agent

      Problem statement: You are experiencing either of the below issues and suspect that another APM product is interfering with the Site24x7 .NET agent. 1. The .NET monitor is not created under APM > APM Insight > Applications, even after the .NET agent ...