IIS8:无法加载类型'System.ServiceModel.Activation.HttpModule'

时间:2013-08-25 22:40:35

标签: c# asp.net asp.net-mvc-4 httphandler iis-8

有很多问题在回答这个问题,但没有一个答案对我有用。

最初,当我尝试PUTDELETE(可能还有其他动词)时,我得到的是405。看一些问题,解决方案似乎是改变处理程序映射。

我更改了以下内容:

ExtensionlessUrlHandler-ISAPI-4.0_32bit
ExtensionlessUrlHandler-ISAPI-4.0_64bit
WebDAV

我注意到动词已经在One of the following verbs框中了,所以在绝望中我将其改为接受所有动词。

现在,我甚至无法加载网页,更不用说像DELETE那样发出任何异国情调的请求了,我立即得到一个黄色的死亡屏幕:

Server Error in '/' Application.

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'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +153
   System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +100
   System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +124
   System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +76

[ConfigurationErrorsException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
   System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +12687536
   System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +69
   System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +66
   System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +300
   System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1262
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +133
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12881108
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12722297

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045

到目前为止,我有:

  1. 通过Web PI安装了经过检查的ASP.NET 4.5
  2. 正在运行dism /online /enable-feature /featurename:IIS-ASPNET45
  3. 正在运行"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r
  4. 正在运行C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -I
  5. 比我能做的更多iisreset
  6. 替换ServiceModel中的applicationHost.config

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

  7. 替换为:

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

    我还能做什么,或者我应该在哪里看?

    由于

    戴夫

5 个答案:

答案 0 :(得分:4)

您还必须使用激活servicemodel 4.0 dism / online / enable-Feature / all / FeatureName:WCF-HTTP-Activation45

和de IIS管理器(服务器 - &gt;功能 - &gt;模块) 检查是否看到servicemodel 4.0然后删除servicemodel。

答案 1 :(得分:2)

在我的计算机上安装Synfusion Essential Studio后,我遇到了同样的问题。 我通过执行以下步骤解决了这个问题:

  1. 打开IIS管理器控制台
  2. 在“服务器”面板上,转到“模块”,“功能视图”
  3. 确保ServiceModule-4.0在那里。如果不存在,请执行上述(1-6)
  4. 中规定的步骤
  5. 删除ServiceModel模块

答案 2 :(得分:1)

想到这可能对某人有帮助。

如果在运行IIS的计算机上有多个版本的.NET Framework,并且在.NET Framework 4.0之后或Windows Communication Foundation中的服务模型注册之前安装了IIS,则会发生此错误。

这是解决此问题的链接。

http://msdn.microsoft.com/en-us/library/hh169179%28v=nav.71%29.aspx

答案 3 :(得分:0)

此链接适用于我。

http://www.codeproject.com/Articles/613812/Solve-IIS-Error-Could-not-load-type-System-Servi

您必须删除ServerModel模块和svc集成处理程序。

答案 4 :(得分:0)

将此添加到我的应用程序的 web.config 对我有用:

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
        <add name="ServiceModel-4.0" type="System.ServiceModel.Activation.ServiceHttpModule, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />
    </modules>
</system.webServer>