Dot Net agent - webservices application won't start - Common Language Runtime detected an invalid program

Document ID : KB000020288
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

After SPM is enabled for a DotNet Webservices application, the application doesn't start and logs an error, indicating the CLR detected an invalid program.

Also, in the Windows Application event log, you may see an error event, with the source WcfServiceHost, and the following description:

Service cannot be started. System.InvalidProgramException: Common Language Runtime detected an invalid program.
at System.ServiceModel.Dispatcher.DispatchRuntime..ctor(EndpointDispatcher endpointDispatcher)
at System.ServiceModel.Dispatcher.EndpointDispatcher..ctor(EndpointAddress address, String contractName, String contractNamespace)

Solution:

This issue can occur as a result of applying Microsoft patches to the .Net framework 2.0 related to their security bulletin MS13-004 . A permanent fix is being prepared, but the following workaround allows the application to run unimpeded:

In the webservices.pbd file, comment out the following line:
#TraceOneMethodWithParametersIfFlagged: WCFRuntimeTracing .ctor WCFCorIDTracer "WebServices"