Troubleshooting steps to identify and resolve the crashing issue while monitoring applications in SharePoint/Multiple domain assembly environments
If you encounter the exception "Loading this assembly would produce a different grant set from other instances" while running the APM Insight .NET agent, follow these steps to identify and resolve the issue:
Understanding the issue
Our APM Insight .NET agent modifies IL code during it's runtime. Hence, the application must be run in full trust environments in single domain mode. In multiple domain scenarios, when the LoadOptimization is set to 2, issues may arise due to shared assembly and security configurations.
Identify the Crashing issue with Agent Logs
1. Navigate to C:\ProgramData\DotnetAgent\AgentLogs and open DotNetAgentManaged.ROOT.w3wp.<PID>-11-29-2023.log.
2. Look for exception entries like the example given below:
DotAgentManaged.ROOT.w3wp.<PID>-11-29-2023.log
- 12/27/2023 2:52:00 PM - [4:(DEBUG)<t:16>] - [TName: ]Creating root tracker..
- 12/27/2023 2:52:00 PM - [4:(DEBUG)<t:16>] - [TName: ]The uri is /Pages/default.aspx
- 12/27/2023 2:52:00 PM - [4:(DEBUG)<t:16>] - [TName: ]Root tracker for the transaction DotNetAgent.Sequences.Sequence is System.ServiceModel.Channels.ServiceChannelProxy.InvokeService
- 12/27/2023 2:52:00 PM - [4:(DEBUG)<t:16>] - [TName: ]Call stack count: 1
- 12/27/2023 2:52:01 PM - [0:(CRITICAL)<t:16>] - Exception captured. An Error occurred during https://xxxxxxxxxx/Pages/default.aspx request/response. Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)
- 12/27/2023 2:52:01 PM - [4:(DEBUG)<t:16>] - [TName: ]Exception Tracker Created.
Identify the Crashing issue with the Application Page
Check the application crashing page for exception information like the one in the image given below:
Identify the Crashing issue with Event Viewer logs
1. Open Event Viewer and navigate to Windows Logs -> Application.
2. Click the event with the source like Application Error or Microsoft-SharePoint products to verify the exception.
Solution
Note: For SharePoint environments, the workaround might not work, as the app DLL itself is designed for multiple domain assembly. In such cases, contact support with UAT setup to explore the possibility of supporting it.
Follow the steps given below to resolve the exception:
- 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.
- Set loader optimization to single domain mode. [Note: This second step is not recommended for Share Point applications]
- For 64 bit applications:
- Open Registry Editor and navigate to the below path, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework"
- Create a new registry DWORD value called "LoaderOptimization" and set the value as 1.
- For 32 bit applications:
- Open Registry Editor and navigate to the below path, "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework"
- Create a new registry DWORD value called "LoaderOptimization" and set the value as 1.
- Reset IIS and access your application.
New to ADSelfService Plus?