Closed sajidali2444 closed 6 years ago
I had the same issue with the proxy approach. To make it work comment line spa.UseProxyToSpaDevelopmentServer("http://localhost:4200"); in startup.cs and use spa.UseAngularCliServer(npmScript: "start");
@sajidali2444 angular cli process takes some time to build the project. If you are running npm start in command line, wait for it to finish before you start the .net project using F5 or similar. See if this fixes your issue.
On the other hand you can change as per @Vencalekl 's instructions to run with single F5 style to run the project.
Closing it for now as there are couple of way to run the projects for now. Hope that is ok.
@Vencalekl @asadsahi - Thank you. The above fix worked.
Thanks @Vencalekl , @asadsahi its working now.
Hi. I am getting the same error. Only when i hit refresh on browser does that error go away.Any ideas how to fix it.I am using VS 2017
@sajidali2444 I was having the same problem, turns out that I was not starting the npm server with npm start
on the ClientApp server.
@sajidali2444 I was having the same problem, turns out that I was not starting the npm server with
npm start
on the ClientApp server.
This also worked for me! Thanks!
@sajidali2444 this also worked for me thank you
I am having same problem - I was able to run "npm start" manully under ClientApp folder and started my React app successfully. But when I tried to run the AspNet Core project, using ...spa.UseReactDevelopmentServer(npmScript: "start") in program startup, I got error like this "HttpRequestException: Failed to proxy the request to http://localhost:49812/, because the request to the proxy target failed. Check that the proxy target server is running and accepting requests to http://localhost:49812/."
Question, where did this dynamic port number come from even I specified the react to start on port 3000 (default)?
4/13/23: Problem solved by making these 2 changes:
1) added this line "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy" to the launchSettings.json file, below the line " "ASPNETCORE_ENVIRONMENT": "Development" (without this line, you will continue to get error like "HttpRequestException: Failed to proxy the request to http://localhost:61505/, because the request to the proxy target failed. Check that the proxy target server is running and accepting requests to http://localhost:61505/.)
2) added this to project properties page: <SpaProxyServerUrl>https://localhost:3000</SpaProxyServerUrl>.
Without this, you will get a Http 500 error:
"This page isn’t working right nowlocalhost can't currently handle this request.
HTTP ERROR 500"
i just downloaded restore everything but proejct not running thorwing errors on port proxy error. not working on localhost:26853 and localhost:5000?
An unhandled exception occurred while processing the request. CurlException: Couldn't connect to server System.Net.Http.CurlHandler.ThrowIfCURLEError(CURLcode error)
HttpRequestException: An error occurred while sending the request. System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
HttpRequestException: Failed to proxy the request to http://localhost:4200/, because the request to the proxy target failed. Check that the proxy target server is running and accepting requests to http://localhost:4200/.
The underlying exception message was 'An error occurred while sending the request.'.Check the InnerException for more details. Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy+d__4.MoveNext()
System.Net.Http.HttpRequestException: Failed to proxy the request to http://localhost:4200/favicon.ico, because the request to the proxy target failed. Check that the proxy target server is running and accepting requests to http://localhost:4200/.