开发者

Error 500 with custom HttpHandler in ASP.NET website (IIS 7.5, Win7)

I'm trying to get custom HttpHandler working in my sample web application. I've been experiencing a lot of issues, but finally got stuck with error 500. Application pool is being run in Classic ASP.NET 2.0 mode. Server is IIS 7.5, OS is Win 7 Pro.

Here's a code of my handler:

public class SampleHandler : IHttpHandler
{
    public SampleHandler()
    {

    }

    public bool开发者_运维问答 IsReusable 
    {
        get 
        {
            return true;
        }
    }

    public void ProcessRequest(HttpContext context) 
    {
        context.Response.Clear();
        context.Response.ContentType = "text/html";
        context.Response.Write("This is a sample content.");
        context.Response.Expires = 0;
        context.Response.End();
    }
}

Here is a web.config file content:

<?xml version="1.0"?>

<configuration>
  <system.web>
    <httpHandlers>
      <add verb="*" path="*.shc" type="SampleHandler"/>
    </httpHandlers>
  </system.web>
  <system.webServer>
    <handlers>
      <add resourceType="Unspecified" verb="*" path="*.shc" name="SampleHandler" type="SampleHandler" modules="IsapiModule" scriptProcessor="c:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll\aspnet_isapi.dll"/>
    </handlers>
  </system.webServer>
</configuration>

Here is a link to the screenshot of an error : http://bit.ly/cmPk4i

Could anybody please tell me what I did wrong? Thanks in advance!


Try setting

<validation validateIntegratedModeConfiguration="false" />

in

<system.webServer>

I had 500 error and this fixed it.

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


From the list of "things you can try", did you install the .Net Extensibility Feature?

You can also enable the Failed Requests logging feature on the application, which provides detailed information on request processing.

The good news, at least, is that your registered handler is recognized as the handler to be executed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜