Search code examples
c#asp.netiisweb-confighttpmodule

"Could not load type xxx" in IIS 8.5 for IHttpModule


I have created an http module in ASP.NET

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

Configured in web.config like this:

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

The module works and loads when run locally in IISExpress. However when I deploy it to my web host under IIS 8.5 I get:

System.Web.HttpException: Could not load type 'aellerb.App_Code.ContentParser'.

Any idea what I am missing here?


Solution

  • Looking through this article I found "Custom handler and module source code can be put in the App_Code folder of an application...".

    So I created a folder called App_Code on the server, and copied my http module .cs file to there. It now loads and problem is solved.