Reputation: 11
I have a WCF service that is build in VS2008 When I publish the service and run it in IIS (32 bit applications are enabled in application pool) then fine, it works. But when I try debugging the application (platform targets of all the projects are Any CPU), I get the following error:
Common Language Runtime detected an invalid program.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidProgramException: Common Language Runtime detected an invalid program.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidProgramException: Common Language Runtime detected an invalid program.]
System.ServiceModel.HostingManager..ctor() +0
System.ServiceModel.ServiceHostingEnvironment.EnsureInitialized() +463
System.ServiceModel.ServiceHostingEnvironment.OnEnsureInitialized(Object state) +185
System.ServiceModel.PartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state) +314
System.ServiceModel.ServiceHostingEnvironment.SafeEnsureInitialized() +209
System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +295
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +344
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +557
What does that error mean?? any help is highly appreciated
Upvotes: 1
Views: 1029
Reputation: 148120
The platform your have for development is 32 bit and the platform on which you deploy is 64 bit
. Selecting the debug type AnyCPU assembly will JIT to 64 bit code when loaded into 64 bit
process and 32 bit
when loaded into a 32 bit
process. The published assembly / dependent assembly is most probably not compatible for 64 bit and need to be in 32 bit process.
You can read more about choosing the target platform and its impact over here.
Upvotes: 1