Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > IIS 6.0 and randolny request timeout

Reply
Thread Tools

IIS 6.0 and randolny request timeout

 
 
felippe
Guest
Posts: n/a
 
      06-28-2006
Hi!
I have got IIS 6.0 on Windows 2003 Server. I have installed HTTP
handler (as simple reverse-proxy) - code below. I created virtual
category with this dll and Wilcard application mapping set to
aspnet_isapi.dll

Now everything works fine, but sometimes IIS stops working and return
'Error in /catalog Application. Request timeout...' And than i must
restart IIS (at least application pools).

Thanks for help,
Filip

Code of Handler.cs:

/*
Handler.cs; v 1.1; 2005/10/25; Filip Balicki
Script capture all references to selected in Web.config virtual
directory, and download resources from
selected (also in Web.config) remote host. (so it is work as
proxy)
*/

using System;
using System.Web;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Collections;
using System.Configuration;

namespace Polygon
{

public class Handler : IHttpHandler
{
string host_address
{
get
//Take local address (where this script
is installed) from
web.config
//http://my_domain/virtual_catalog/
{
return
ParseUrl(ConfigurationSettings.AppSettings["local_address"]);
}
}
string dest_adress
{
get
//Take local address (where this script
is installed) from
web.config
//http://my_domain/virtual_catalog/
{
return
ParseUrl(ConfigurationSettings.AppSettings["destination_host"]);
}
}
public void ProcessRequest(HttpContext context)
{

string my_uri = context.Request.Url.ToString();
//construct real uri to remote host
string real_uri = Regex.Replace (my_uri,
host_address,dest_adress,RegexOptions.Multiline |
RegexOptions.IgnoreCase);
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create(real_uri);
request.KeepAlive = false;
request.AllowAutoRedirect = false;
HttpWebResponse response;
try
{
response = (HttpWebResponse)
request.GetResponse();
}
catch(System.Net.WebException we)
{
context.Response.StatusCode = 404;
context.Response.StatusDescription =
"Not Found ("+we.Message+")";
response = (HttpWebResponse)
we.Response;
writeBody(context, response);
return;
}
if (response.StatusCode != HttpStatusCode.OK)
//Found not OK header - probably
redirect
{
context.Response.AddHeader("Location",
response.Headers["Location"]);

context.Response.AddHeader("Content-Type", response.ContentType);
context.Response.StatusCode = (int)
response.StatusCode;
}
else
{

context.Response.AddHeader("Content-Type", response.ContentType);
writeBody (context, response);
}
response.Close();
context.Response.End();

}

public bool IsReusable
{
get
{
return true;
}
}

public string ParseUrl (string url)
{
if ((char)url[url.Length-1]!= '/')
{
url+='/';
}
return url;
}

public void writeBody (HttpContext context,
HttpWebResponse response)
{
Stream receiveStream =
response.GetResponseStream();
if
((response.ContentType.ToLower().IndexOf("html")>= 0)

||(response.ContentType.ToLower().IndexOf("javascr ipt")>=0))
//if we get html or javascript use ASCI
mode
{
string body;
StreamReader readStream = new
StreamReader (receiveStream,
Encoding.Default);
body = readStream.ReadToEnd();
context.Response.Write(body);
}
else
{
//the response is not HTML - use binary
mode
byte[] buff = new byte[1024];
int bytes = 0;
while( ( bytes = receiveStream.Read(
buff, 0, 1024 ) ) > 0 )
{
//Write the stream directly to
the client

context.Response.OutputStream.Write (buff, 0, bytes );
}
}
response.Close();
}

}

 
Reply With Quote
 
 
 
 
Mike Brind
Guest
Posts: n/a
 
      06-28-2006

felippe wrote:
> Hi!
> I have got IIS 6.0 on Windows 2003 Server. I have installed HTTP
> handler (as simple reverse-proxy) - code below. I created virtual
> category with this dll and Wilcard application mapping set to
> aspnet_isapi.dll
>


This newsgroup is for classic asp. Dotnet is a different technology.
You should try asking in microsoft.public.dotnet.framework.aspnet

--
Mike Brind

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Request Timeout - Request has been aborted Greg ASP .Net 0 02-02-2009 04:42 PM
WebService ignoring timeout properties? (Server was unable to process request. --> Timeout exired) Lars-Erik Aabech ASP .Net Web Services 3 04-29-2005 02:21 AM
Timeout::timeout and Socket timeout Mark Probert Ruby 1 10-06-2004 09:30 AM
IIS timeout, IE timeout or what? Just D ASP .Net 2 06-21-2004 09:43 AM
Re: Accessing Request.InputStream / Request.BinaryRead *as the request is occuring*: How??? Brian Birtle ASP .Net 2 10-16-2003 02:11 PM



Advertisments