473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

IIS 6.0 and randolny request timeout

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();
}

}

Jun 28 '06 #1
1 3761

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

Jun 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dicky Cheng | last post by:
Hi, I am using .net remoting technology. I set up a .net remoting client and server in IIS. When the client calls the server, the server will run a long duration method (30-60seconds). I have a...
8
by: Shalini | last post by:
If I have an ASPX page that is just sleeping for 3 minutes ormore and later does some processing and the ExecutionTimeout parameter in the machine.config is 90 seconds then the page does not...
5
by: Ed | last post by:
I have some questions in regards to Session variables and IIS Recycling: 1. Does the IIS setting 'Shutdown worker process after being idle' affect an application's session variables? Or is IIS...
1
by: a.r.austin | last post by:
Hello, I am trying to download a few files one after another from a remote server. Problem is that I don't know how to, or if I am able at all, set a time out for download. I don't want to time...
1
by: tudor | last post by:
I have a web service that I use to kick off a long-running job that dumps a lot of data to an XML file (takes about 5 minutes). I need to have ASP.NET produce the XML file as the web site has the...
12
by: Sophie000 | last post by:
I am implementing a peer-to-peer program: When a computer A receives “get file XXX” from stdio, it broadcasts (floods) a request packet to ask others. Both Computer B and C have the file so they...
0
by: mmomar | last post by:
Hi, I am using a HTTPS connection to invoke a cgi-script. I want to use a timeout between the sending the request and receiving the response, so what I want to do is when the request is send,...
2
by: JimLad | last post by:
Hi, I've got a very basic asp.net page that accesses a very slow db query and siplays to screen. I'm hitting a timeout aftre about 3.5 to 4.5 minutes - seems to be variable. SQL connection...
4
by: Burton Roberts | last post by:
I'm new to this. I'm developing a simple WCF service with a Winforms application on my laptop (2008). It seems to run okay accepting inserts, updates and deletes and sending datasets back through...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.