[Mono-list] Request.InputStream exception

Peter petervyvey at village.uunet.be
Thu Sep 15 01:11:18 EDT 2005


Hello,

I am trying to implement an IHttpHandler, using the following code to read the 
content of the request:

...

public void ProcessRequest(HttpContext context) 
{ 
        try 
        {
                StreamReader _streamReader = new 
StreamReader(context.Request.InputStream); 
                string _request = _streamReader.ReadToEnd(); 
                this._context = context; 
                this.RequestRouter(); 
        } 
        catch 
        { 
                throw; 
        } 
}

...

I get an exception:

Error Message: HTTP 500.

Stack Trace:

System.IO.IOException: Read failure

Server stack trace: 
in <0x000c3> System.Net.Sockets.NetworkStream:Read (System.Byte[] buffer, 
Int32 offset, Int32 size)
in <0x00095> System.IO.BinaryReader:Read (System.Byte[] buffer, Int32 index, 
Int32 count)
in <0x00075> Mono.WebServer.ModMonoRequest:GetClientBlock (System.Byte[] 
bytes, Int32 position, Int32 size)
in <0x00019> Mono.WebServer.ModMonoWorker:Read (System.Byte[] buffer, Int32 
position, Int32 size)
in <0x001aa> Mono.WebServer.BaseRequestBroker:Read (Int32 requestId, Int32 
size, System.Byte[] buffer)
in (wrapper remoting-invoke-with-check) Mono.WebServer.BaseRequestBroker:Read 
(int,int,byte[]&)
in (wrapper xdomain-dispatch) Mono.WebServer.BaseRequestBroker:Read 
(object,byte[]&,byte[]&,int,int,byte[]&)

Exception rethrown at [0]: 
 ---> System.Net.Sockets.SocketException: Operation on non-blocking socket 
would block
in <0x0006d> System.Net.Sockets.Socket:Receive_nochecks (System.Byte[] buf, 
Int32 offset, Int32 size, SocketFlags flags)
in <0x00053> System.Net.Sockets.Socket:Receive (System.Byte[] buf, Int32 
offset, Int32 size, SocketFlags flags)
in <0x00075> System.Net.Sockets.NetworkStream:Read (System.Byte[] buffer, 
Int32 offset, Int32 size)--- End of inner exception stack trace ---

in (wrapper xdomain-invoke) Mono.WebServer.BaseRequestBroker:Read 
(int,int,byte[]&)
in (wrapper remoting-invoke-with-check) Mono.WebServer.BaseRequestBroker:Read 
(int,int,byte[]&)
in <0x0003d> Mono.WebServer.ModMonoWorkerRequest:ReadEntityBody (System.Byte[] 
buffer, Int32 size)
in <0x00326> System.Web.HttpRequest:MakeInputStream ()
in <0x00013> System.Web.HttpRequest:get_InputStream ()
in <0x00028> HttpRequestDemo.RequestHandler:RequestRouter ()

I think it is while accessing 'context.Request.InputStream'. This code works 
under .Net framework 1.1. Does anyone have an idea what is wrong ?

Regards,

Peter


More information about the Mono-list mailing list