windows 8 - HttpClient throws error on SendAsync (C#) -
my code (c#):
httpclienthandler httpclienthandler = new httpclienthandler(); httpclienthandler.preauthenticate = true; //httpclienthandler.usedefaultcredentials = true; httpclienthandler.credentials = credentialcache.defaultnetworkcredentials; //httpclienthandler.credentials = new networkcredential("usr", "pw", "domain"); httpclienthandler.cookiecontainer = new cookiecontainer(); var httpcontent = new stringcontent(content); httpclient httpclient = new httpclient(httpclienthandler); httpclient.defaultrequestheaders.expectcontinue = false; httpclient.baseaddress = ews_url; // var request = httpclient.postasync(ews_url, httpcontent); var requestmessage = new httprequestmessage(); requestmessage.requesturi = ews_url; requestmessage.content = httpcontent; requestmessage.method = httpmethod.post; var request = httpclient.sendasync(requestmessage); httpresponsemessage response = await request; // --> error
the instance of httpclient (httpclient) runs exception in line marked --> error comment. can not find wrong code lines. exception says: "the underlying connection closed", "error on sending" connection not closed see. tried several options "usedefaultcredentials true/false", "new networkcredentials".
my scenario app sending soap messages exchange web services (ews).
do have ideas solving problem?
Comments
Post a Comment