打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
win8 下 WCF "Could not load type 'System.ServiceModel.Activation.HttpModule'" 错误解决方案

Symptoms

  Consider the following scenario. You install the .NET Framework 4.0. Then, you install an earlier version of the .NET Framework, or you enable .NET 3.0 WCF HTTP Activation. In this scenario, you may receive the following error message when you when run applications that are hosted on Internet Information Services (IIS):

Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 
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.TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

 

Cause

  This issue occurs because the Applicationhost.config file for Windows Process Activation Service (WAS) has the following section defined, and this section is incompatible with the .NET Framework 4.0:

<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />

  This section should be defined as follows:

<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler,runtimeVersionv2.0" />

  Note You can find the Applicationhost.config file in the following location:

%windir%\system32\inetsrv\config

 

Resolution

  To resolve this issue, run the following command line: 

aspnet_regiis.exe /iru

  The Aspnet_regiis.exe file can be found in one of the following locations:

%windir%\Microsoft.NET\Framework\v4.0.30319

%windir%\Microsoft.NET\Framework64\v4.0.30319 (on a 64-bit computer)

 

注意

  以上方案在win8系统中无效,因为在最后一步运行 aspnet_regiis.exe /iru 命令时会失败,所以解决方案是找到 Applicationhost.config 文件(目录在%windir%\system32\inetsrv\config),然后把文件中的:

<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />

  改为:

<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler,runtimeVersionv2.0" />

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Windows 7 中未能从程序集System.ServiceModel
WCF之旅(3):在WCF中实现双向通信(Bi-directional Communication)
ASP.NET Ajax调用WCF服务的代码示例
抛弃WebService 在.NET4中用jQuery调用WCF
WCF编程系列(一)初识WCF
无废话WCF入门教程四[WCF的配置文件]
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服