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系統(tǒng)中無效,因為在最后一步運行 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
相關(guān)文章
Win8.1 KB5021294補丁月度更新匯總!(附完整更新日志)
微軟已向用戶發(fā)布了Win8.1月度更新匯總,補丁為KB5021294,下文為大家?guī)砹嗽敿毜母陆榻B,需要的朋友一起看看吧2022-12-15微軟警告:Win8.1系統(tǒng)即將停止支持,將很快彈窗提醒,建議購買 Win11/1
6月24日消息,據(jù)報道,微軟正準備開展行動,通知Windows8.1用戶關(guān)于該產(chǎn)品的停止支持日期,下面隨小編一起來看看吧2022-06-24win8系統(tǒng)怎么加密文件?win8系統(tǒng)加密文件詳細操作方法
這篇文章主要介紹了win8系統(tǒng)怎么加密文件?win8系統(tǒng)加密文件詳細操作方法的相關(guān)資料,需要的朋友可以參考下本文詳細內(nèi)容介紹2022-06-13win8系統(tǒng)如何設(shè)置開機密碼?Win8系統(tǒng)設(shè)置開機密碼操作教程
這篇文章主要介紹了win8系統(tǒng)如何設(shè)置開機密碼?Win8系統(tǒng)設(shè)置開機密碼操作教程的相關(guān)資料,需要的朋友可以參考下本文詳細內(nèi)容介紹2022-06-13- 這篇文章主要介紹了Win8系統(tǒng)在后臺運行打印機程序操作教程的相關(guān)資料,需要的朋友可以參考下本文詳細內(nèi)容介紹2022-06-13
Win8系統(tǒng)安全證書過期怎么辦?Win8系統(tǒng)安全證書過期的解決方法
這篇文章主要介紹了Win8系統(tǒng)安全證書過期怎么辦?Win8系統(tǒng)安全證書過期的解決方法的相關(guān)資料,需要的朋友可以參考下本文詳細內(nèi)容介紹2022-06-13win8系統(tǒng)還原怎么操作呢?win8電腦系統(tǒng)還原詳細步驟
如何解決Win10瀏覽器打不開網(wǎng)頁但能上網(wǎng)?最近很多用戶向小編反應(yīng)升級了win10系統(tǒng)之后在下載軟件或者打開第三方網(wǎng)頁的時候會出現(xiàn)病毒誤報,該怎么辦呢?跟隨小編來看看吧2020-12-31- Win8臨時文件夾如何修改路徑?Win8臨時文件夾文件過多會影響速度,我們可以通過修改文件路徑很好的解決這一問題,下面讓我們來看看如何修改2020-12-22
- Win8系統(tǒng)如何設(shè)置鼠標左右鍵互換?最近很多小伙伴向小編咨詢關(guān)于Win8系統(tǒng)設(shè)置鼠標左右鍵互換的問題,下面就跟隨小編一起學習吧2020-12-11
Win8系統(tǒng)怎么關(guān)閉系統(tǒng)還原?
Win8系統(tǒng)怎么關(guān)閉系統(tǒng)還原?最近很多win8系統(tǒng)的用戶向小編咨詢想要關(guān)閉系統(tǒng)還原,不知道如何操作,不妨我們一起來看看下文的教程吧2020-12-09