Hi. I have REST API server on my vagrant machine. And I write client for it 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("http://api.mysite.ru/getAll");
}
catch (HttpRequestException e)
Debug.WriteLine(e.Message);
Trouble:
Exception thrown: 'System.Net.Http.HttpRequestException' in mscorlib.ni.dllAn error occurred while sending the request.
If I send request to another (non-vagrant) host, all is OK.
Question: How I can solve this?
F*cking with this for third day. Thanks)