“500 Internal Server Error” when adding HttpModule in my Website?

蹲街弑〆低调 提交于 2019-12-01 17:29:15

问题


I am having a website (developed in ASP.NET 2.0 (C#)) registered with godaddy.com But when I am adding HttpModule in my web.config as follow:

<httpModules>
  <add type="WwwSubDomainModule" name="WwwSubDomainModule" />
</httpModules>

but it gives me "500 Internal Server Error". When I removed the above tag then my website is working fine. Can anyone guess why its creating this problem??


回答1:


Got it guys :)

I was facing this problem since last October 2008, but finally I got this why? Instead of adding modules like I have added above in my question, use the following new module syntax made for IIS7 (godaddy is using IIS7 for windows hosting)

<configuration>
   <system.webServer>
      <modules>
         <add name="Header" type="Contoso.ShoppingCart.Header"/>
      </modules>
   </system.webServer>
</configuration>

Place all your modules under here and you're done! It's nice and works perfect!

And "@Jon Skeet" there is no need to have namespace for modules, even without namespace you can get it work!

Do read more about this tag here http://www.iis.net/ConfigReference/system.webServer/modules




回答2:


What is WwwSubDomainModule? I strongly suspect you need to specify the namespace and possibly the assembly name. If you turn verbose error logging on, it should give you more information too.



来源:https://stackoverflow.com/questions/573325/500-internal-server-error-when-adding-httpmodule-in-my-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!