botframework-sdk: An unhandled exception has occurred while executing the request. System.Net.Http.HttpRequestException: Address not available
Github issues should be used for bugs and feature requests. Use Stack Overflow for general “how-to” questions.
Version
What package version of the SDK are you using.
I use this container as build environment : mcr.microsoft.com/dotnet/sdk:3.1-alpine on Windows 10 OS build 19043.964 and use Bot framework emulator version 4.13 to test on windows.
Describe the bug
Give a clear and concise description of what the bug is.
When I run an emptybot in an alpine container, and test it with bot framework emulator, this error happens :
/mybot # dotnet run --urls http://0.0.0.0:80
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://0.0.0.0:80
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: /mybot
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 POST http://localhost:8080/api/messages application/json 625
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'EmptyBot.Controllers.BotController.PostAsync (mybot)'
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]
Route matched with {action = "Post", controller = "Bot"}. Executing controller action with signature System.Threading.Tasks.Task PostAsync() on controller EmptyBot.Controllers.BotController (mybot).
info: Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter[0]
Received an incoming activity. ActivityId: f506fe20-b123-11eb-8956-b3b98984e597
info: Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter[0]
Sending activity. ReplyToId: f506fe20-b123-11eb-8956-b3b98984e597
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]
Executed action EmptyBot.Controllers.BotController.PostAsync (mybot) in 550.7759ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'EmptyBot.Controllers.BotController.PostAsync (mybot)'
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.Net.Http.HttpRequestException: Address not available
---> System.Net.Sockets.SocketException (99): Address not available
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync(String conversationId, String activityId, Activity activity, Dictionary`2 customHeaders, CancellationToken cancellationToken)
at Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync(IConversations operations, String conversationId, String activityId, Activity activity, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.BotFrameworkAdapter.SendActivitiesAsync(ITurnContext turnContext, Activity[] activities, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.TurnContext.<>c__DisplayClass31_0.<<SendActivitiesAsync>g__SendActivitiesThroughAdapter|1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Bot.Builder.TurnContext.SendActivityAsync(IActivity activity, CancellationToken cancellationToken)
at EmptyBot.EmptyBot.OnMembersAddedAsync(IList`1 membersAdded, ITurnContext`1 turnContext, CancellationToken cancellationToken) in /mybot/EmptyBot.cs:line 22
at Microsoft.Bot.Builder.ActivityHandler.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.BotFrameworkAdapter.TenantIdWorkaroundForTeamsMiddleware.OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.MiddlewareSet.ReceiveActivityWithStatusAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.BotFrameworkAdapter.ProcessActivityAsync(ClaimsIdentity claimsIdentity, Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.BotFrameworkAdapter.ProcessActivityAsync(String authHeader, Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter.ProcessAsync(HttpRequest httpRequest, HttpResponse httpResponse, IBot bot, CancellationToken cancellationToken)
at EmptyBot.Controllers.BotController.PostAsync() in /mybot/Controllers/BotController.cs:line 34
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished in 704.1886ms 500 text/plain
and in emulator this error is shown : POST 500 directline/conversations/<conversationId>/activities
To Reproduce
Steps to reproduce the behavior:
sudo docker pull mcr.microsoft.com/dotnet/sdk:3.1-alpine
docker run --rm -it -p 8080:80 mcr.microsoft.com/dotnet/sdk:3.1-alpine sh
mkdir mybot
cd mybot
dotnet new -i Microsoft.Bot.Framework.CSharp.EmptyBot
dotnet new emptybot
dotnet run --urls http://0.0.0.0:80
- Go to bot framework emulator
- Open bot on this url :
http://localhost:8080/api/messages
- Look at the error and pull your hair.
Expected behavior
Give a clear and concise description of what you expected to happen.
When I do not use an alpine container and run an empty bot in windows, it works as expected and sends me a welcome message in emulator.
Running in alpine container should behave similarly, bot it doesn’t.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Please help me to fix this ❤️
Tracking Status
Dotnet SDK TODO
- PR
- Merged
Javascript SDK TODO
- PR
- Merged
Python SDK TODO
- PR
- Merged
Java SDK TODO
- PR
- Merged
Samples TODO
- PR
- Merged
Docs TODO
- PR
- Merged
Tools TODO
- PR
- Merged
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 15 (4 by maintainers)
Apologies, my docker skills are a bit rusty. I should have an answer for you by this morning.
on it!
@jwiley84 Can you please try to reproduce this - docker king.
@jwiley84 If you’re having docker issues, is there another support engineer who look into this?
@jwiley84 Any updates on this issue?
I can no longer reproduce this issue. Thank you for the fix.
Sorry for late reply… Without ngrok, it doesn’t work, either in vps, or in desktop, either inside the container or outside of it. But as you said when I configure ngrok in emulator, it works. When I use ngrok externally, it doesn’t work again! I need to check if that works when I publish my bot and connect it completely. I will send further information here after other tests… Thank you for your responds.
My sincerest apologies. I’m having a significant difficulty getting docker to run on my computer.
could you reproduce that error ? or that error happened just in my side ?! sadly my project is stand by just because of this error 😦