简体   繁体   English

经典到集成模式,http 处理程序未运行

[英]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.

相关问题 在集成模式下运行的 IIS 7 Classic ASP 应用程序 - IIS 7 Classic ASP application running in Integrated mode 自定义异步HTTP处理程序仅在IIS 7.5集成模式下生成错误500 - 为什么? - Custom Asynchronous HTTP Handlers generate Error 500 in IIS 7.5 Integrated Mode only - Why? 当应用程序在集成模式下运行时,为什么IIS7与具有classicmode前提条件的处理程序匹配? - Why is IIS7 matching to handlers with the classicmode precondition when the app is running in integrated mode? 应用程序池模式问题:经典或集成 - Application Pool Mode Problem: Classic Or Integrated IIS ASP.NET何时使用集成模式或经典模式? - IIS ASP.NET when to use Integrated Mode or Classic Mode? IIS7中的“经典”和“集成”管道模式有什么区别? - What is the difference between 'classic' and 'integrated' pipeline mode in IIS7? 将IIS从经典模式切换到集成模式时锁定和高CPU - Locking and high CPU when switching IIS from Classic to Integrated mode 自定义HttpModule可在IIS7中集成,但不是经典模式 - Custom HttpModule working in IIS7 integrated, but not classic mode IIS7集成管道模式比经典慢 - IIS7 integrated pipeline mode slower than classic httpsodules(经典模式)Vs模块(集成模式)不以相同方式解析请求 - httpmodules(Classic Mode) Vs Modules (Integrated mode) not parsing request in the same way
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM