I want post simple json to server with this code:
var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://ipaddress:1237");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{'params': {'auth_remoteaddr': '10.10.5.103', 'auth_type': 'ANONYMOUS', 'auth_name': 'ANONYMOUS', 'auth_pass': 'ANONYMOUS', 'login_auth_name': 'crm', 'login_auth_pass': 'crm1234', 'create_session': true, 'login_auth_type': 'ADMIN'}, 'method': 'login.login'}";
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
but when run that code,get the this error:
Additional information: The underlying connection was closed: The connection was closed unexpectedly.
but in the past that service succeeded without a problem, what happened? How can i solve that problem?