如何使用 .ashx 文件在 IIS 7.0 集成模式下注册 HttpHandler

发布于 2024-09-30 04:36:52 字数 648 浏览 0 评论 0原文

根据文档,如果您在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黄昏下泛黄的笔记 2024-10-07 04:36:52

您无需注册,只需像常规 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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文