-
Notifications
You must be signed in to change notification settings - Fork 368
SocketException when running the solution #47
Comments
Seems the URL the FrontEnd uses to speak to the BackEnd is misconfigured. Ensure that the BackEnd is listening on the URL you have configured for the FrontEnd (in the |
I have a similar problem, but I have double checked my An unhandled exception occurred while processing the request. System.Net.Http.ConnectHelper.ConnectAsync(string host, int port, CancellationToken cancellationToken) System.Net.Http.ConnectHelper.ConnectAsync(string host, int port, CancellationToken cancellationToken) SocketException: No connection could be made because the target machine actively refused it HttpRequestException: No connection could be made because the target machine actively refused it System.Net.Http.ConnectHelper.ConnectAsync(string host, int port, CancellationToken cancellationToken)
FrontEnd.Pages.IndexModel.OnGet(int day) in Index.cshtml.cs
Microsoft.AspNetCore.Mvc.RazorPages.Internal.ExecutorFactory+NonGenericTaskHandlerMethod.Execute(object receiver, object[] arguments) |
@jc184 Can you browse directly to the back end service URL listed in |
Yes, I can do that. The backend functions normally, so it must be a problem in the Front End project.
Sent from Mail for Windows 10
From: Jon Galloway
Sent: 27 July 2019 18:26
To: dotnet-presentations/aspnetcore-app-workshop
Cc: james chalmers; Mention
Subject: Re: [dotnet-presentations/aspnetcore-app-workshop] SocketExceptionwhen running the solution (#47)
@jc184 Can you browse directly to the back end service URL listed in appsettings.json?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This is my FrontEnd {
"ServiceUrl": "http://localhost:50039/",
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*"
} and this is my BackEnd {
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50039/",
"sslPort": 44387
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BackEnd": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "",
"applicationUrl": "https://localhost:44387;http://localhost:50039",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
} Let me know if you spot any errors! |
Which URL do you use to browse to the back end when it works? |
I am getting also similar error..please anyone can help me to solve this problem. An unhandled exception occurred while processing the request. SocketException: No connection could be made because the target machine actively refused it. HttpRequestException: No connection could be made because the target machine actively refused it. SocketException: No connection could be made because the target machine actively refused it. HttpRequestException: No connection could be made because the target machine actively refused it. FrontEnd.Services.ApiClient.GetSessionsAsync() in ApiClient.cs
FrontEnd.Pages.IndexModel.OnGet(int day) in Index.cshtml.cs
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+NonGenericTaskHandlerMethod.Execute(object receiver, object[] arguments) This is my FrontEnd appsettings.json: "Logging": { and this is my BackEnd launchsettings.json: { |
I am having a challenge similar to what is listed above. Does anyone please have a good solution??? Kindly help ASAP!!! |
for this challenge. i set my lauchsetting for frontend like this "FrontEnd": { |
System.Net.Http.HttpRequestException: Aucune connexion n’a pu être établie car l’ordinateur cible l’a expressément refusée ---> System.Net.Sockets.SocketException: Aucune connexion n’a pu être établie car l’ordinateur cible l’a expressément refusée
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.Threading.Tasks.ValueTask
1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask
1.get_Result()at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask
1 creationTask) at System.Threading.Tasks.ValueTask
1.get_Result()at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at FrontEnd.Services.ApiClient.GetSessionsAsync() in C:\Users\Maher\Documents\GitHub\aspnetcore-app-workshop\src\FrontEnd\Services\ApiClient.cs:line 63
at FrontEnd.Services.ApiClient.GetSessionsByAttendeeAsync(String name) in C:\Users\Maher\Documents\GitHub\aspnetcore-app-workshop\src\FrontEnd\Services\ApiClient.cs:line 147
at FrontEnd.Pages.IndexModel.OnGetAsync(Int32 day) in C:\Users\Maher\Documents\GitHub\aspnetcore-app-workshop\src\FrontEnd\Pages\Index.cshtml.cs:line 43
at Microsoft.AspNetCore.Mvc.RazorPages.Internal.ExecutorFactory.NonGenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
at Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker.InvokeHandlerMethodAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker.InvokeNextPageFilterAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
at Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
The text was updated successfully, but these errors were encountered: