开发者

http handler example doesn't work in .net 4, VS2010 cassini

I just tried this simple example in a new web site to create an http handler in .net 4:

http://msdn.microsoft.com/en-us/library/ms228090.aspx#Y700

It looks so simple - I just copied the http handler class into my app code directory - it simply response.writes out some html. Basic stuff. The web.config entry is even simpler:

<system.webServer>
<handlers>
  <add verb="*" path="*.sample"
    name="HelloWorldHandler"
    type="HelloWorldHandler"/>
</handlers>

As the article suggests, I've tried requesting test.sample in my browser but got a 404 error. The same code works like a charm if I crea开发者_运维知识库te an ashx file instead of the class file/web config method.


You need to put the handler in the httphandler portion of the system.web in addition to the system.webserver (Which is needed for IIS7+)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜