win8 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" />
我目前只找到这种方案,如果有更好方案欢迎指出。
作者:Artwl
出处:http://artwl.cnblogs.com
相关文章

Win8.1 KB5021294补丁月度更新汇总!(附完整更新日志)
微软已向用户发布了Win8.1月度更新汇总,补丁为KB5021294,下文为大家带来了详细的更新介绍,需要的朋友一起看看吧2022-12-15
微软警告:Win8.1系统即将停止支持,将很快弹窗提醒,建议购买 Win11/1
6月24日消息,据报道,微软正准备开展行动,通知Windows8.1用户关于该产品的停止支持日期,下面随小编一起来看看吧2022-06-24
这篇文章主要介绍了win8系统怎么加密文件?win8系统加密文件详细操作方法的相关资料,需要的朋友可以参考下本文详细内容介绍2022-06-13
win8系统如何设置开机密码?Win8系统设置开机密码操作教程
这篇文章主要介绍了win8系统如何设置开机密码?Win8系统设置开机密码操作教程的相关资料,需要的朋友可以参考下本文详细内容介绍2022-06-13
这篇文章主要介绍了Win8系统在后台运行打印机程序操作教程的相关资料,需要的朋友可以参考下本文详细内容介绍2022-06-13
Win8系统安全证书过期怎么办?Win8系统安全证书过期的解决方法
这篇文章主要介绍了Win8系统安全证书过期怎么办?Win8系统安全证书过期的解决方法的相关资料,需要的朋友可以参考下本文详细内容介绍2022-06-13
如何解决Win10浏览器打不开网页但能上网?最近很多用户向小编反应升级了win10系统之后在下载软件或者打开第三方网页的时候会出现病毒误报,该怎么办呢?跟随小编来看看吧2020-12-31
Win8临时文件夹如何修改路径?Win8临时文件夹文件过多会影响速度,我们可以通过修改文件路径很好的解决这一问题,下面让我们来看看如何修改2020-12-22
Win8系统如何设置鼠标左右键互换?最近很多小伙伴向小编咨询关于Win8系统设置鼠标左右键互换的问题,下面就跟随小编一起学习吧2020-12-11
Win8系统怎么关闭系统还原?最近很多win8系统的用户向小编咨询想要关闭系统还原,不知道如何操作,不妨我们一起来看看下文的教程吧2020-12-09












最新评论