Solve IIS 8 Error: Could not load type ‘System.ServiceModel.Activation.HttpModule’
2013-06-30 17:10
1126 查看
I met an error when I was deploying my WebSocket server application which targeted .NET 4.5 to Windows Server 2012 plus IIS 8. It was an exception shown in browser whenever I tried to open a web page. The exception said:"Could
not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'".
When I was working on IIS 7.5, I heard about this problem and knew the cause: the default configuration in applicationHost.config (inC:\Windows\System32\inetsrv\config) declared two conflicted modules
and two conflicted handlers:
and handlers loaded by default. “ServiceModel” and “svc-Integrated” were for .NET Activation 3.x while “ServiceModel-4.0”
and “svc-Integrated-4.0” were for .NET Activation 4.x.Unfortunately, the 3.x items were declared before the 4.x items. That was why the exception occurred for a .NET 4.x web application!
Then how did such situation happen? On Windows Server 2008, it could happen when you install .NET 3.x framework or IIS 7.5 with Activation features after .NET framework 4.x is installed. However,on Windows Server 2012, it always
happens when you install .NET framework 3.x with Activation features.
Microsoft officially announced the solution (http://support.microsoft.com/kb/2015129) for Windows Server 2008 plus IIS 7.5: manually running “aspnet_regiis.exe
/iru” for .NET framework 4.x (in C:\Windows\Microsoft.NET\Framework\v4.0.30319 or C:\Windows\Microsoft.NET\Framework64\v4.0.30319). However,aspnet_regiis.exe is not allowed to run for IIS
8. I tried manual changing applicationHost.config. I also tried removing and adding features in a good order. But all these solutions did not work.
The final solution was to delete the 3.x module and handler from IIS manager. You could delete them at the application or site level if you want to keep them in applicationHost.config. But
I wanted to delete them from applicationHost.config. So I did the following steps:
1. In IIS manager, click the machine name node.
2. In “Features View”, double-click “Modules”.
3. Find “ServiceModel” and remove it.
4. Go back to the machine name node’s “Features View”, double-click “Handler Mappings”.
5. Find “svc-Integrated” and remove it.
Now everything works well.
not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'".
When I was working on IIS 7.5, I heard about this problem and knew the cause: the default configuration in applicationHost.config (inC:\Windows\System32\inetsrv\config) declared two conflicted modules
and two conflicted handlers:
<modules> <add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" /> <add name="ServiceModel-4.0" type="System.ServiceModel.Activation.ServiceHttpModule, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler,runtimeVersionv4.0" /> </modules> <handlers> <add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode" /> <add name="svc-Integrated-4.0" path="*.svc" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers>As we know, applicationHost.config contains the root settings for all web sites and web applications on the server. Therefore, any web application would have all the four conflicted modules
and handlers loaded by default. “ServiceModel” and “svc-Integrated” were for .NET Activation 3.x while “ServiceModel-4.0”
and “svc-Integrated-4.0” were for .NET Activation 4.x.Unfortunately, the 3.x items were declared before the 4.x items. That was why the exception occurred for a .NET 4.x web application!
Then how did such situation happen? On Windows Server 2008, it could happen when you install .NET 3.x framework or IIS 7.5 with Activation features after .NET framework 4.x is installed. However,on Windows Server 2012, it always
happens when you install .NET framework 3.x with Activation features.
Microsoft officially announced the solution (http://support.microsoft.com/kb/2015129) for Windows Server 2008 plus IIS 7.5: manually running “aspnet_regiis.exe
/iru” for .NET framework 4.x (in C:\Windows\Microsoft.NET\Framework\v4.0.30319 or C:\Windows\Microsoft.NET\Framework64\v4.0.30319). However,aspnet_regiis.exe is not allowed to run for IIS
8. I tried manual changing applicationHost.config. I also tried removing and adding features in a good order. But all these solutions did not work.
The final solution was to delete the 3.x module and handler from IIS manager. You could delete them at the application or site level if you want to keep them in applicationHost.config. But
I wanted to delete them from applicationHost.config. So I did the following steps:
1. In IIS manager, click the machine name node.
2. In “Features View”, double-click “Modules”.
3. Find “ServiceModel” and remove it.
4. Go back to the machine name node’s “Features View”, double-click “Handler Mappings”.
5. Find “svc-Integrated” and remove it.
Now everything works well.
相关文章推荐
- Solve IIS 8 Error: Could not load type ‘System.ServiceModel.Activation.HttpModule’
- Resolve error: Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’
- Could not load type System.ServiceModel.Activation.HttpModule解决办法
- 解决:Could not load type 'System.ServiceModel.Activation.HttpModule' from assemb
- Could not load type System.ServiceModel.Activation.HttpModule解决办法
- Could not load type System.ServiceModel.Activation.HttpModule解决办法
- Could not load type ‘System.ServiceModel.Activation.HttpModule’ from&
- IIS8排错:Could not load type ‘System.ServiceModel.Activation.HttpModule’
- win8 Could not load type System.ServiceModel.Activation.HttpModule 错误解决方案
- Could not load type System.ServiceModel.Activation.HttpModule解决办法
- 解决:Could not load type 'System.ServiceModel.Activation.HttpModule' from assemb
- win8 iis8 发布wcf服务,诡异的Could not load type System.ServiceModel.Activation.HttpModule
- Could not load type ‘System.ServiceModel.Activation.HttpModule’ from&
- Exception: Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’
- Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’
- WCF:Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’
- 解决:Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceMode
- System.TypeLoadException for System.ServiceModel.Activation.HttpModule in ASP.NET 4
- ASP.NET 4.0 无法加载 System.ServiceModel.Activation.HttpModule
- IIS Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceMo