Could not load type 'System.ServiceModel.Activ

2019-01-12 20:41发布

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 ?

标签: iis service svc
12条回答
仙女界的扛把子
2楼-- · 2019-01-12 21:17

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.

查看更多
我只想做你的唯一
3楼-- · 2019-01-12 21:20

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
查看更多
对你真心纯属浪费
4楼-- · 2019-01-12 21:21

Ok, finally got it.

Change this line in System32/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>
查看更多
走好不送
5楼-- · 2019-01-12 21:21

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.

查看更多
做个烂人
6楼-- · 2019-01-12 21:23

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

查看更多
再贱就再见
7楼-- · 2019-01-12 21:25

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

查看更多
登录 后发表回答