[英]Classic to integrated mode, http handlers not running
I'm migrating an old application from classic mode to integrated mode, and the previously registered http handlers no longer work.我正在将一个旧应用程序从经典模式迁移到集成模式,之前注册的 http 处理程序不再工作。 I've placed the handlers section under system.webServer where they're supposed to go, but no dice:
我已经将处理程序部分放在 system.webServer 下他们应该去的地方,但没有骰子:
<system.webServer>
<handlers>
...
<add name="zip.ashx_*" path="zip.ashx" verb="*" type="ZipDownloadHandler, Assembly" preCondition="integratedMode,runtimeVersionv2.0" resourceType="Unspecified" />
<add name="file.ashx_*" path="file.ashx" verb="*" type="FileDownloadHandler, Assembly" preCondition="integratedMode,runtimeVersionv2.0" resourceType="Unspecified" />
<add name="stream.ashx_*" path="stream.ashx" verb="GET" type="StreamDownloadHandler, Assembly" preCondition="integratedMode,runtimeVersionv2.0" resourceType="Unspecified" />
</handlers>
...
</system.webServer>
But they always return 404. The config dump from但他们总是返回 404。配置转储来自
appcmd list config "Default Web Site/MyApp" -section:system.webServer/handlers
displays the handlers correctly:正确显示处理程序:
<system.webServer>
<handlers accessPolicy="Read, Script">
...
<add name="zip.ashx_*" path="zip.ashx" verb="*" type="ZipDownloadHandler, Assembly" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="file.ashx_*" path="file.ashx" verb="*" type="FileDownloadHandler, Assembly" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="stream.ashx_*" path="stream.ashx" verb="GET" type="StreamDownloadHandler, Assembly" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv2.0" />
...
If I switch from stream.ashx to registering the handler path as stream.foo, I still get a 404, but the error page is different.如果我从 stream.ashx 切换到将处理程序路径注册为 stream.foo,我仍然得到 404,但错误页面不同。 For stream.ashx, it looks like this , and for stream.foo it looks like this .
对于stream.ashx,它看起来像这样,而对于stream.foo,它看起来像这样。
Perhaps stream.ashx is actually triggering the *.ashx handler which then looks for a file named stream.ashx, but can't find one.也许stream.ashx 实际上触发了*.ashx 处理程序,然后该处理程序查找名为stream.ashx 的文件,但找不到。 I really don't know what's going on with the other handler though, because my config looks correct.
我真的不知道其他处理程序发生了什么,因为我的配置看起来是正确的。 Any suggestions would be appreciated.
任何建议,将不胜感激。
I never did get this to work, so I simply replaced the module registration in web.config with a route handler:我从来没有让它工作,所以我只是用路由处理程序替换了 web.config 中的模块注册:
RouteTable.Routes.Add("stream", new Route("stream", new RouteHandler(new StreamDownloadHandler())));
RouteTable.Routes.Add("file", new Route("file", new RouteHandler(new FileDownloadHandler())));
RouteTable.Routes.Add("zip", new Route("zip", new RouteHandler(new ZipDownloadHandler())));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.