0

部署后我无法在 azure 中使用 htpphandlers,在本地机器上可以。

在 web.config 我声明如下

<system.web>
<httpHandlers>
  <add verb="*" path="*.cspx" type="WebRole1.Handle,WebRole1"/>
</httpHandlers>

在我的 handler.cs 文件中,我编写如下。

namespace WebRole1

{ 公共类句柄 : IHttpHandler { #region IHttpHandler 成员

    bool IHttpHandler.IsReusable
    {
        get { return true; }
    }

    void IHttpHandler.ProcessRequest(HttpContext context)
    {
        context.Server.Transfer("Test.aspx", true);         
    }
    #endregion
}

}

在我的本地机器上它工作正常。但是在部署到 Windows azure 后出现 500 内部服务器错误。

4

1 回答 1

1

我认为您的问题与在 system.web 而不是 system.webserver 中使用自定义处理程序有关。

将您的自定义 HTTP 处理程序移动到 System.webserver,如下所示:

<system.webserver>
 <httpHandlers>
  <add verb="*" path="*.cspx" type="WebRole1.Handle,WebRole1"/>
</httpHandlers>
<system.webserver>
于 2012-05-24T15:43:10.390 回答