如何使用 .ashx 文件在 IIS 7.0 集成模式下注册 HttpHandler
根据文档,如果您在 dll 中实现 IHttpHandler
并将其放在 Web 应用程序的 Bin
文件夹中,那么如何在 IIS 7.0 集成模式下注册 HttpHandler 是很清楚的。然后在该应用程序的 web.config
中添加一行即可完成注册过程。 有一个 .ASHX
文件类型默认实现 IHttpHandler
。由于此文件未编译到 Bin 文件夹中的 dll 中(并且我没有找到编译后它的位置),因此请尝试在 web.config
中为其添加正确的 type
对我来说失败了。 web.config
:
<handlers>
<add name="MyHandler" path="*" verb="*" type="MyHandler, Myhandler"resourceType="unspecified" precondition"integratedmode" />
</handlers>
问题:如何注册.ASHX
文件中编写的HttpHandlers
?
According to documents it's clear how to register HttpHandlers in IIS 7.0 integrated mode if you implement IHttpHandler
inside a dll and put it in Bin
folder of web application. Then adding a line in web.config
of that application completes the registeration process.
There is an .ASHX
file type which implements IHttpHandler
by default. Since this file is not compiled into dll in Bin folder (and I didn't find where it go after compilation) any try to add correct type
for it in web.config
failed for me. web.config
:
<handlers>
<add name="MyHandler" path="*" verb="*" type="MyHandler, Myhandler"resourceType="unspecified" precondition"integratedmode" />
</handlers>
Question: How to register HttpHandlers
written in .ASHX
files ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无需注册,只需像常规 aspx、asmx 或 html 文件一样调用 ashx 文件即可。 http://yourweb.com/yourhandler.ashx :)
You don't register, you just call your ashx-file like a regular aspx, asmx or html file. http://yourweb.com/yourhandler.ashx :)