C# 在执行当前web请求期间发生WCF未处理异常

C# 在执行当前web请求期间发生WCF未处理异常,c#,asp.net,wcf,C#,Asp.net,Wcf,我有一个在VS2008中构建的WCF服务 当我发布服务并在IIS中运行它(在应用程序池中启用32位应用程序)时,一切正常。 但是,当我尝试调试应用程序时(所有项目的平台目标都是任何CPU),我得到了以下错误: Common Language Runtime detected an invalid program. Description: An unhandled exception occurred during the execution of the current web re

我有一个在VS2008中构建的WCF服务 当我发布服务并在IIS中运行它(在应用程序池中启用32位应用程序)时,一切正常。 但是,当我尝试调试应用程序时(所有项目的平台目标都是任何CPU),我得到了以下错误:

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
这个错误是什么意思??
非常感谢您的帮助

您用于开发的平台是32位的,您部署的平台是64位的。当加载到
64位
进程时,选择调试类型AnyCPU程序集将JIT为64位代码;当加载到
32位
进程时,选择调试类型AnyCPU程序集将JIT为
32位
。发布的程序集/依赖程序集很可能与64位不兼容,需要在32位进程中


您可以阅读更多有关选择目标平台及其影响的信息。

感谢您的回答,我尝试更改为x86,但这又产生了另一个错误。我尝试在另一台有VS2008 professional edition的机器上运行该应用程序(在这台机器上是developers edition),它在这台机器上运行,所以我现在尝试卸载VS并安装professional edition,我会让您知道发生了什么选择x86构建它,然后部署x86生成的assemblyAdil,那没用。它不工作,我卸载了VS2008并安装了专业版,这没有帮助。我选择x86构建,但这也没有帮助,仍然会得到与您在OP中所说的相同的错误消息,如果这是真的,那么您必须这样做OP[“我有一个WCF服务,它是在VS2008中构建的,当我发布该服务并在IIS中运行它时(应用程序池中启用了32位应用程序),那么很好,它可以工作。”]如果我从IIS运行它,它仍然可以工作,但当我尝试打开项目解决方案并调试应用程序时,它就不能工作了。我需要在应用程序中做一些更改,我需要跟踪,如果它在VS中不起作用,我就无法跟踪