2014-04-01 50 views
1

我有一个在VS2008中构建的WCF服务 当我发布服务并在IIS中运行它(在应用程序池中启用了32位应用程序)时,作品。 但是当我尝试调试应用程序(所有项目的平台目标任何CPU),我收到以下错误:在执行当前Web请求期间发生WCF未处理的异常

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 

是什么错误意味着? 任何帮助,高度赞赏

回答

1

您的开发平台是32位和您部署的平台是64 bit。选择调试类型AnyCPU程序集将JIT转换为64位代码加载到64 bit进程和32 bit加载到32 bit进程中。发布的程序集/相关程序集很可能不兼容64位,需要使用32位程序。

您可以阅读更多关于选择目标平台及其对here的影响。

+0

感谢您的回答,我尝试更改为x86但生成另一个错误。 我试着在VS2008专业版的另一台机器上运行应用程序(在这台机器上它是开发者版本),它在那台机器上工作,所以我试图卸载VS并安装专业版,我会让你知道会发生什么 – user3484399

+0

构建它选择x86,然后部署x86生成的程序集 – Adil

+0

Adil,这没有帮助。 它不工作,我卸载VS2008和安装专业版,没有帮助。 我建立了选择x86,但也没有帮助,仍然得到相同的错误信息 – user3484399

相关问题