Error reading the HTTPListenerRequest InputStream

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi Friends,

When I try to read the incoming client request data using the
HttpListenerRequest.InputStream property, I'm getting the following
exception (not everytime) -

System.Net.HttpListenerException: The I/O operation has been aborted
because of either a thread exit or an application request

Server stack trace:
at System.Net.HttpRequestStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
at HttpListenerLibrary.HttpListenerWrapper.ProcessRequest() in
C:\AcsSim\HttpListenerLibrary\HttpListenerLibrary.cs:line 901
at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage
msg, Int32 methodPtr, Boolean fExecuteInContext)

The server doesn't crash after this but stops receiving any further
requests. What could be the problem that makes it do so ?

Do I have any way of finding out what kind of request is this ?
Can I programmatically insert a breakpoint in the code when this
exception comes ?
How can I ensure that if this exception happens my HttpListener still
continues to receive packets ?

Thanks for going through my problem.

Regards,
Kunal

P.S. The code that I use to read the inputstream is as follows -

if (!request.HasEntityBody)
{
Console.WriteLine("No client data was sent with the request.");
return;
}
System.IO.Stream body = request.InputStream;
System.Text.Encoding encoding = request.ContentEncoding;
System.IO.StreamReader reader = new System.IO.StreamReader(body,
encoding);


string s = reader.ReadToEnd();
Console.WriteLine(s);
body.Close();
reader.Close();

.



Relevant Pages

  • Server Error in /Remote Application
    ... configuration file located in the root directory of the current web ... Exception Details: System.UnauthorizedAccessException: Access to the path ... granting access rights to the resource to the ASP.NET request identity. ... System.IO.StreamWriter.CreateFile(String path, Boolean append) +55 ...
    (microsoft.public.windows.server.sbs)
  • .net user permissions in IIS
    ... We have a windows 2003 domain with 4 web servers in. ... (Exception from HRESULT: 0x80070005 ... the current web request. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Driver verifier cause SYSTEM_SERVICE_EXCEPTION
    ... a request that has a cancel routine assigned to it (e.g. you called ... An exception happened while executing a system service routine. ... The problem is that when the driver receives its first IOCTL and it is ... to complete or even forward this request a BSOD is reported. ...
    (microsoft.public.development.device.drivers)
  • Re: Driver verifier cause SYSTEM_SERVICE_EXCEPTION
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ... a request that has a cancel routine assigned to it (e.g. you called ... > An exception happened while executing a system service routine. ...
    (microsoft.public.development.device.drivers)
  • Re: .net user permissions in IIS
    ... The exception message has all the information you need to correct this ... You can right -click on the folder containing the resources where access is ... account, or add the needed account and grant it permission. ... the current web request. ...
    (microsoft.public.dotnet.framework.aspnet)