经典到集成模式,http 处理程序不是 运行
Classic to integrated mode, http handlers not running
我正在将一个旧应用程序从经典模式迁移到集成模式,之前注册的 http 处理程序不再工作。我已将处理程序部分放在 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>
但他们总是return 404。来自
的配置转储
appcmd list config "Default Web Site/MyApp" -section:system.webServer/handlers
正确显示处理程序:
<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" />
...
如果我从 stream.ashx 切换到将处理程序路径注册为 stream.foo,我仍然会收到 404,但错误页面不同。对于 stream.ashx,它看起来是 like this, and for stream.foo it looks like this。
也许 stream.ashx 实际上触发了 *.ashx 处理程序,该处理程序随后查找名为 stream.ashx 的文件,但找不到。我真的不知道其他处理程序发生了什么,因为我的配置看起来是正确的。如有任何建议,我们将不胜感激。
我从来没有让它起作用,所以我只是用路由处理程序替换了 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())));
我正在将一个旧应用程序从经典模式迁移到集成模式,之前注册的 http 处理程序不再工作。我已将处理程序部分放在 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>
但他们总是return 404。来自
的配置转储appcmd list config "Default Web Site/MyApp" -section:system.webServer/handlers
正确显示处理程序:
<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" />
...
如果我从 stream.ashx 切换到将处理程序路径注册为 stream.foo,我仍然会收到 404,但错误页面不同。对于 stream.ashx,它看起来是 like this, and for stream.foo it looks like this。
也许 stream.ashx 实际上触发了 *.ashx 处理程序,该处理程序随后查找名为 stream.ashx 的文件,但找不到。我真的不知道其他处理程序发生了什么,因为我的配置看起来是正确的。如有任何建议,我们将不胜感激。
我从来没有让它起作用,所以我只是用路由处理程序替换了 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())));