c# - HttpWebRequest the underlying connection was closed -


I HttpWebRequest to POST byte array image via the web I am using the services, the size of the picture is something like byte [4096]

code:

  http webbrand webquery = ( HTTP WebBurm) WebRequest.Create (wsHost); WebRequest.Headers.Add (HttpRequestHeader.AcceptEncoding, "gzip, deflate"); WebRequest.Headers.Add (HttpRequestHeader.KeepAlive, "true");   

I get an error:

  The underlying connection was closed.   

Is there a server problem or is there a posting problem?

This can be a large number, can you connect to the server otherwise?

If this is the case, try to keep the anticipated 100 (before doing your post)

  System.Net.ServicePointManager.Expect100Continue = False;   

According to the HTTP 1.1 protocol, when this header is sent, the form data is not sent from the initial request. Instead, this header is sent to the web server that responds with 100 (continued) if it has been implemented correctly. However, not all web servers handle this correctly, including the server in which I am trying to post data.

If another source does not work: Suggestions that many people have resolved their requests in the form of HTTP 1.0 requests:

  HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create (wsHost); WebRequest.KeepAlive = Incorrect; WebRequest.ProtocolVersion = HttpVersion.version10;    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -