Could not load type module C#

I am very new to VS for web applications and modules,

I am trying to run/debug a http module so I followed this helpful tutorial:

https://dotnetcodr.com/2015/07/10/how-to-register-a-custom-http-module-in-your-net-web-application/

and I got to debug his test module inside my sample WebApplication.

Now I linked my module inside that sample WebApplication, I edited the Web.config replacing this:

  <add name="DescriptiveNameOfModule" type="HttpModuleTestApplication.Modules.TestModule"/>

with my module

  <add name="DescriptiveNameOfModule" type="MyHttpModule11.MyHttpModule"/>

but when I run it I am getting a page containing the following error:

    [HttpException (0x80004005): Could not load type 'MyHttpModule11.MyHttpModule'.]
   System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +9972697
   System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +38

[ConfigurationErrorsException: Could not load type 'MyHttpModule11.MyHttpModule'.]
   System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +353
   System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, Boolean checkAptcaBit) +21
   System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +39
   System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +42
   System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +160
   System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1068
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +82
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +173
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Could not load type 'MyHttpModule11.MyHttpModule'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10085804
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

What could be the reason? Might it be caused by an IIS different version?


You may need to include the name of the assembly in which this type resides. eg.

<modules>
    <add name="DescriptiveNameOfModule" type="MyHttpModule11.MyHttpModule, AssemblyNameWithoutExtension"/>
</modules>
链接地址: http://www.djcxy.com/p/43804.html

上一篇: 我怎样才能在IIS7工作中获得gzip压缩?

下一篇: 无法加载类型模块C#