由于请求筛选,自定义处理程序无法正常工作

时间:2012-08-18 05:31:21

标签: c# asp.net iis-7 web-config httphandler

这是在IIS快递中。

public class FooHandler : HttpTaskAsyncHandler
{

    public override async Task ProcessRequestAsync(HttpContext context)
    {
        var val = await new FooRequest().ProcessRequest();

        context.Response.Write(val);
    }
}

处理程序及以下是web.config。

<configuration>
    <appSettings>
      <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    </appSettings>
    <system.web>
      <sessionState mode="Off" />
      <compilation debug="true" targetFramework="4.5" />
      <machineKey compatibilityMode="Framework45" />

      <httpHandlers> 
        <add verb="*" path="*.foo" validate="false" type="FooServer.FooHandler" />   
      </httpHandlers>
    </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />

    <handlers>
      <add name="FooHandler" verb="*" path="*.foo" type="FooServer.FooHandler" /> 
    </handlers>

  </system.webServer> 
</configuration>

我一直收到以下错误。谷歌没有帮助。你可以吗?

HTTP Error 404.7 - Not Found
The request filtering module is configured to deny the file extension.
Most likely causes:

    Request filtering is configured for the Web server and the file extension for this request is explicitly denied.

0 个答案:

没有答案
相关问题