From the agent log:
MM/DD/YY HH:MM:SS AM EST [DEBUG] [IntroscopeAgent.Agent]
System.IO.FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)
at com.wily.introscope.agent.connection.IsengardServerConnectionManager.connectInternalAdvanced(ServerInstanceLocator serverLocator, Boolean hasFallbacks)
at com.wily.introscope.agent.connection.ConnectionThread.attemptAdvancedConnection(Boolean firstConnectionAttempt)
From the event log:
MM/DD/YYYY HH:MM:SS
Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileLoadException
Stack:
Server stack trace:
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
at System.ServiceModel.Channels.BufferedConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at Microsoft.ApplicationServer.Caching.CacheResolverChannel.Open(TimeSpan timeout)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
at Microsoft.ApplicationServer.Caching.ChannelContainer.Opened(System.IAsyncResult)
at System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessageSink)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
MM/DD/YYYY HH:MM:SS
An unhandled exception occurred and the process was terminated.
This problem has been reported in Microsoft SharePoint environments when monitoring directory services calls. Other situations may also experience the problem.
This issue is caused by the CLR core that is trying to optimize a reload of the instrumentation agent with an incompatible CAS grant set. This usually happens when the SharePoint site web.config is set to use the legacy CAS model, as introduced in .NET version 4 and provokes the error as described previously.
Refer to https://msdn.microsoft.com/en-us/library/vstudio/dd984947(v=vs.100).aspx for a reference of CAS changes in ASP.NET 4.
Change assembly load optimization for the .Net Framework.
These are the steps to implement this solution:
Note: You must be logged on as an Administrator to perform these steps. If you aren't logged in as a Administrator, you can only change settings that apply to your user account. Before you make changes to a registry key or sub-key, we recommend that you export, or make a backup copy, of the key or sub-key. You can save the backup copy to a specified location, such as a folder on your hard disk or a removable storage device. If making changes that you want to undo, you can import the backup copy.
Configure the following registry settings using regedit.exe:
In key ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework’, create a new ‘DWORD (32-bit) Value’ named "LoaderOptimization" with a value 1 (either in decimal or hexadecimal as they are the same).
In key ‘HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework‘, create a new ‘DWORD (32-bit) Value’ named "LoaderOptimization" with a value 1 (either in decimal or hexadecimal as they are the same).
This configuration will disable the loader optimization of assemblies that provoke the aforementioned behaviour by setting assembly loading into SingleDomain mode.
Please refer to LoaderOptimization Enumeration for more details.