Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel

梦想的初衷 提交于 2019-11-26 22:31:10

问题


I'm running my Web Project in IIS.

It is a 4.0 Framework APP.

I have a Service.svc and I get this error when I run my Application.

"Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'"

I tried this --> aspnet_regiis.exe -iru which I found in a lot of forums and it didn't solve my problem.

Does anyone know another method ?


回答1:


Try with

c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -iru

When multiple versions of the .NET Framework are executing side-by-side on a single computer, the ASP.NET ISAPI version mapped to an ASP.NET application determines which version of the common language runtime (CLR) is used for the application.

Above command will Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and only registers ASP.NET in IIS.

https://support.microsoft.com/en-us/help/2015129/error-message-after-you-install-the--net-framework-4-0-could-not-load




回答2:


I have Windows 8 installed on my machine, and the aspnet_regiis.exe tool did not worked for me either.

The solution that worked for me is posted on this link, on the answer by Neha: System.ServiceModel.Activation.HttpModule error

Everywhere the problem to this solution was mentioned as re-registering aspNet by using aspnet_regiis.exe. But this did not work for me.

Though this is a valid solution (as explained beautifully here)

but it did not work with Windows 8.

For Windows 8 you need to Windows features and enable everything under ".Net Framework 3.5" and ".Net Framework 4.5 Advanced Services".

Thanks Neha




回答3:


Hello Thanks for the question; To resolve: "Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'"

In Windows Features check all for .NET 4 Advanced Services & .NET 3.5

Just like Nicolas Gago I tried aspnet_regiis.exe -iru but it didn't work. After the features were on then it yellow screen error was gone. Thanks;




回答4:


You can install these features on windows server 2012 with powershell using the following commands:

Install-WindowsFeature -Name  NET-Framework-Features -IncludeAllSubFeature
Install-WindowsFeature -Name  NET-WCF-HTTP-Activation45 -IncludeAllSubFeature

You can get a list of features with the following command:

Get-WindowsFeature | Format-Table



回答5:


Ok, finally got it.

Change this line in %windir%\System32\inetsrv\Config\ApplicationHost.config

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

To

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

If this is not enough

Add this following line to the Web.config

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>



回答6:


In Windows server 2012. Go to ISS -> Modules -> Remove the ServiceModel3-0.




回答7:


From the Server Manager's Features node, you can also remove some of the sub-items under the .NET Framework 3.5.1 Features that are installed by the activation of some of the other roles.

For instance, removed the WCF Activation Features as follows and our websites came back:

  • [x] .NET Framework 3.5.1 Features
    • [x] .NET Framework 3.5.1
    • [ ] WCF Activation
      • [ ] HTTP Activation
      • [ ] Non-HTTP Activation

Note: this did not require a restart for us.




回答8:


Details

http://msdn.microsoft.com/en-us/library/hh169179(v=nav.71).aspx

"This error can occur when there are multiple versions of the .NET Framework on the computer that is running IIS..."




回答9:


I got this error after I accidentally published one website into the directory of another website. The two websites had different versions of .net. What fixed it for me was changing the application pool. To do that, in the IIS manager:

click the website => Advanced Settings... (on the right) => click to the right of Application Pool => a button with "..." should appear => select ".NET v4.5 Classic"

If that application pool doesn't work, try some of the others.




回答10:


We are using a web service along side a web site and when we publish the web site it returns same this error. We found out that by going into IIS and removing the ServiceModel from Modules and the svc-Integrated from the Handler Mappings the error went away.




回答11:


I am late, hope it will help someone ....This is a known issue with IIS 8.0

The solution is 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. do the following steps:

In IIS manager, click the machine name node. In “Features View”, double-click “Modules”. Find “ServiceModel” and remove it. Image 1 for Solve IIS 8 Error: Could not load type ‘System.ServiceModel.Activation.HttpModule’

Go back to the machine name node’s “Features View”, double-click “Handler Mappings”. Find “svc-Integrated” and remove it. Image 2 for Solve IIS 8 Error: Could not load type ‘System.ServiceModel.Activation.HttpModule’




回答12:


delete the module which is identified in .Net error message , 1 down vote

In Windows server 2012. Go to ISS -> Modules -> Remove the ServiceModel3-0. (without number worked for me)




回答13:


start-> Run--> c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -iru



来源:https://stackoverflow.com/questions/15688930/could-not-load-type-system-servicemodel-activation-httpmodule-from-assembly-s

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!