【问题标题】:"Could not load type xxx" in IIS 8.5 for IHttpModule在 IIS 8.5 中为 IHttpModule 加载“无法加载类型 xxx”
【发布时间】:2017-09-21 20:27:38
【问题描述】:

我在 ASP.NET 中创建了一个 http 模块

namespace aellerb.App_Code
{
  public class ContentParser : IHttpModule
  {
     ...
  }
}

在 web.config 中这样配置:

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true">
    <add name="ContentParser" type="aellerb.App_Code.ContentParser"/>
  </modules>
</system.webServer>

该模块在 IISExpress 中本地运行时工作并加载。但是,当我在 IIS 8.5 下将它部署到我的网络主机时,我得到:

System.Web.HttpException:无法加载类型“aellerb.App_Code.ContentParser”。

知道我在这里缺少什么吗?

【问题讨论】:

    标签: c# asp.net iis web-config httpmodule


    【解决方案1】:

    您可能需要声明程序集名称 试试这个

    <system.webServer>
      <modules runAllManagedModulesForAllRequests="true">
        <add name="ContentParser" type="aellerb.App_Code.ContentParser, {your_web_application_dllname_without_extention_name}"/>
      </modules>
    </system.webServer>
    

    【讨论】:

    • 不,在我的情况下这不是必需的。
    • 对不起,我没有那个了。
    【解决方案2】:

    浏览这个article我发现“自定义处理程序和模块源代码可以放在应用程序的App_Code文件夹中......”。

    所以我在服务器上创建了一个名为 App_Code 的文件夹,并将我的 http 模块 .cs 文件复制到那里。它现在加载并解决了问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-14
      • 2015-08-28
      相关资源
      最近更新 更多