0
votes

I am working using custom IHttpHandler in my application. It is working fine in IIS 5. But now we are migrating to IIS 7 so we bought 2008 R2 server. Here it is not working. Kindly Help. you can reach me in [email protected]. Thanks in advance. This is my Custom Handler Code :

public class WebRequestHandler : IHttpHandler, IRequiresSessionState
{
private void ProcessDataRequest(HttpContext context)
{
Controller controller = new Controller();
controller.ProcessDataRequest(context);
}

region IHttpHandler Members


public bool IsReusable
{
get { return true; }
}


public void ProcessRequest(HttpContext context)
{
var segments = context.Request.Url.Segments;
var request = segments[segments.Length - 1];

context.Response.Expires = -1;

switch (request)
{
case "data.lst":
this.ProcessDataRequest(context);
return;
}
}

endregion

}


And i am calling like this.

this.client = new WebClient();
this.client.DownloadProgressChanged += this.OnProgressChanged;
this.client.OpenReadCompleted += this.OnDataAvailable;
this.client.OpenReadAsync(new Uri("../data.lst?viewerID=viewer", UriKind.Relative), "GET");
But the ProcessRequest(HttpContext context) method is not called in IIS 7 after publishing.
Kindly Reply to this post. Thanks in advance.
This is my web.config content: configuration>
appSettings>
add key="ChartHttpHandler" value="Storage=memory;Timeout=180;Url=~/temp/;"/>
connectionStrings/>
system.web>
profile>
properties>
add name="searchSettings" defaultValue="" type="System.String"/>
/properties>
/profile>
sessionState timeout="2">
/sessionState>
compilation debug="true" targetFramework="4.0">
assemblies>
add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/>
authentication mode="Windows"/>

httpHandlers>
add verb="GET,POST" path="*.lst" type="App_Code.WebRequestHandler"/>
/httpHandlers>
pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
system.webServer>
validation validateIntegratedModeConfiguration="false"/>
handlers>
add name="WebRequests" verb="" path=".lst" modules="IsapiModule"
scriptProcessor="%path%\aspnet_isapi.dll" ype="App_Code.WebRequestHandler"/> /handlers>
/system.webServer>
system.serviceModel>
behaviors>
serviceBehaviors>
/serviceBehaviors>
/behaviors>
services>
/services>
/system.serviceModel>
/configuration>

1

1 Answers

0
votes

Check out the related question HttpHandler not working in IIS 7

To resume, use the <system.webServer> <handlers> instead...