Azure 和 HttpHandler

发布于 2024-12-21 14:17:17 字数 1232 浏览 3 评论 0原文

我有一个用于 ASP.NET MVC 应用程序的 HttpHandler。我已经测试了 asp.net 和 asp.net mvc 3 应用程序的处理程序,一切都按预期工作。

当我在基于 Azure 的 asp.net mvc 3 应用程序中使用 HttpHandler 时,不会调用“ProcessRequest”方法 - 我可以看到正在创建的 HttpHandler。

我有以下 web.config,这适用于标准 asp.net mvc 3 应用程序:

  <system.web>
    <httpHandlers>
      <add type="TestWebRole.Infrastructure.HttpHandlers.EPubHandler"
           path="*.epub"
           verb="*" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <handlers>
      <add name="EPubHandler"
           type="TestWebRole.Infrastructure.HttpHandlers.EPubHandler"
           path="*.epub"
           verb="*"
           resourceType="Unspecified"
           allowPathInfo="false"
           modules="IsapiModule"
           scriptProcessor="%path%\aspnet_isapi.dll"/>
    </handlers>
  </system.webServer>

我还在 global.asax.cs 文件中指定了忽略 asp.net ,mvc 路由的扩展类型的以下语句:

 routes.IgnoreRoute("{resource}.epub/{*pathInfo}");

做什么我必须进行配置才能在 Azure 中运行时使其正常运行 - 本地运行还是部署到云中?

I have a HttpHandler for an asp.net mvc application. I've tested the handler for asp.net and asp.net mvc 3 applications and everything works as expected.

When I use the HttpHandler in an Azure based asp.net mvc 3 application the 'ProcessRequest' method is NOT being called - I can see the HttpHandler being created.

I have the following web.config and this works for a standard asp.net mvc 3 app:

  <system.web>
    <httpHandlers>
      <add type="TestWebRole.Infrastructure.HttpHandlers.EPubHandler"
           path="*.epub"
           verb="*" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <handlers>
      <add name="EPubHandler"
           type="TestWebRole.Infrastructure.HttpHandlers.EPubHandler"
           path="*.epub"
           verb="*"
           resourceType="Unspecified"
           allowPathInfo="false"
           modules="IsapiModule"
           scriptProcessor="%path%\aspnet_isapi.dll"/>
    </handlers>
  </system.webServer>

I also have the following statement in the global.asax.cs file to specify ignoring asp.net ,mvc routing for the extension type:

 routes.IgnoreRoute("{resource}.epub/{*pathInfo}");

What do I have to configure to get this working when running in Azure - locally or deployed into the cloud?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

掩耳倾听 2024-12-28 14:17:17

只是为了尝试,为什么不删除 system.web 下的 httpHandlers 部分并仅将其保留在 system.webServer 中。并且还从 system.webServer 下的属性中删除所有不必要的属性(scriptProcessor、modules、allowPathInfo)。

您还可以检查任何未处理的异常、事件日志条目以及任何显示某种错误的内容。

Just to try, why don't you remove the httpHandlers section under system.web and leave only that in the system.webServer. And also strip all the unnecessary attributes from the one under system.webServer (scriptProcessor, modules, allowPathInfo).

And also you may check for any uncought exception, event log entry, anything showing some kind of error.

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