【问题标题】:IIS8: Could not load type 'System.ServiceModel.Activation.HttpModule'IIS8:无法加载类型“System.ServiceModel.Activation.HttpModule”
【发布时间】:2013-08-25 22:40:35
【问题描述】:

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

最初,当我尝试 PUTDELETE(可能还有其他动词)时,我得到了 405。看了一些问题,解决方法似乎是改变Handler Mappings。

我更改了以下内容:

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. 已检查 ASP.NET 4.5 已通过 Web PI 安装
  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. iisresets 比我能做的多
  6. 替换applicationHost.config中的ServiceModel

    <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,runtimeVersionv4.0" />

我还能做什么,或者我应该去哪里寻找?

谢谢

戴夫

【问题讨论】:

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


    【解决方案1】:

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

    在 de IIS 管理器中(服务器 -> 功能 -> 模块) 检查您是否看到 servicemodel 4.0,然后删除 servicemodel。

    【讨论】:

    • “/all”标志有所不同。
    【解决方案2】:

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

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

    【讨论】:

      【解决方案3】:

      只是觉得这可能会对某人有所帮助。

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

      这里是解决这个问题的链接。

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

      【讨论】:

      • 能否编辑您的解决方案以包含链接中的信息?
      • 虽然链接的站点可能有助于解决问题,但最好在此处包含站点的基本部分并提供链接以供参考。如果链接页面发生更改,链接可能会失效。
      【解决方案4】:

      此链接对我有用。

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

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

      【讨论】:

        【解决方案5】:

        将此添加到我的应用程序的 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>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-03-19
          • 1970-01-01
          • 2012-08-14
          • 2015-08-28
          • 2016-03-05
          • 2014-08-09
          • 2015-04-16
          • 2010-09-08
          相关资源
          最近更新 更多