c# - Http.HttpRequestException to vagrant host -


i have rest api server on vagrant machine. , write client on c# (vs2015).

have same code:

using (httpclient client = new httpclient()) {     client.baseaddress = new uri(_server);     client.defaultrequestheaders.accept.clear();     client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json"));      httpresponsemessage response = null;      try     {          response = await client.getasync(_action);     }     catch (httprequestexception e)     {         debug.writeline(e.message);     } } 

trouble:

exception thrown: 'system.net.http.httprequestexception' in mscorlib.ni.dll error occurred while sending request.

if send request (non-vagrant) host, ok.

question: how can solve this?

thanks)

updated

stack trace

exception thrown: 'system.net.http.httprequestexception' in mscorlib.ni.dll mess: error occurred while sending request.    @ system.net.http.httpclienthandler.<sendasync>d__1.movenext() --- end of stack trace previous location exception thrown ---    @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task)    @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task)    @ system.runtime.compilerservices.taskawaiter`1.getresult()    @ uborka.models.apimodel.<_response>d__17.movenext() 


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -