aspnet / aspnet-docker

[Archived] ASP.NET Core Docker images for 1.x. Go to https://github.com/dotnet/dotnet-docker for 2.1 and up.
https://asp.net
719 stars 171 forks source link

Inside container running app giving error System.Net.Http.WinHttpException: The server name or address could not be resolved #393

Closed arupbaroi closed 6 years ago

arupbaroi commented 6 years ago

I am running a asp.net core api application inside a docker container which is FROM microsoft/aspnetcore:2.0-nanoserver-sac2016. In my app I am calling a public url (api running on azure) using HttpClient. Without docker I am able to get data from the url , but inside docker container I am getting the follwoing exception:

System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.WinHttpException: The server name or address could not be resolved at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.RendezvousAwaitable1.GetResult() at System.Net.Http.WinHttpHandler.<StartRequest>d__105.MoveNext() --- End of inner exception stack trace --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at System.Net.Http.HttpClient.d58.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at HON.SPS.SIOT.CA.REPORT.API.Utility.ReportDataClient.d1.MoveNext() in C:\src\HON.SPS.SIOT.CA.REPORT.API\Utility\ReportDataClient.cs:line 60 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at WebApplication1.Implementation.AssetReportMgr.d11.MoveNext() in C:\src\HON.SPS.SIOT.CA.REPORT.API\Implementation\AssetReportMgr.cs:line 166 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at WebApplication1.Implementation.AssetReportMgr.d10.MoveNext() in C:\src\HON.SPS.SIOT.CA.REPORT.API\Implementation\AssetReportMgr.cs:line 133

Steps to reproduce the issue

  1. Use windows docker container for a asp.net core api and call any api with HttpClient library.

Expected behavior

HttpClient should work correctly. Because if I am running this app in local or any azure instance it is working fine. Same should be from docker windows container.

Actual behavior

I am getting exception which I have mentioned earlier.

natemcmaster commented 6 years ago

This issue doesn't contain enough information for us to try and reproduce the error. Can you please include more information about the exact steps that cause this error? Ideally, this would be a small standalone C# app that we can run.

arupbaroi commented 6 years ago

Closing the issue because not able to replicate the issue again.