tareqimbasher / NetPad

A cross-platform C# editor and playground.
MIT License
1.31k stars 67 forks source link

Error on starup (win10) #155

Closed lexarchik closed 8 months ago

lexarchik commented 8 months ago

Empty window without controls and with error text:

Failed to proxy the request to http://localhost:9000/?win=main\u0026winId=137fad34-dea3-4d46-9c2f-e9bbe1b878d2, because the request to the proxy target failed. Check that the proxy target server is running and accepting requests to http://localhost:9000/.\n\nThe underlying exception message was \u0027No connection could be made because the target machine actively refused it. (localhost:9000)\u0027.Check the InnerException for more details.","details":"System.Net.Http.HttpRequestException: Failed to proxy the request to http://localhost:9000/?win=main\u0026winId=137fad34-dea3-4d46-9c2f-e9bbe1b878d2, because the request to the proxy target failed. Check that the proxy target server is running and accepting requests to http://localhost:9000/.\n\nThe underlying exception message was \u0027No connection could be made because the target machine actively refused it. (localhost:9000)\u0027.Check the InnerException for more details.
 ---\u003E System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:9000)
 ---\u003E System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.\u003CConnectAsync\u003Eg__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation\u00601.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.\u003CSendAsync\u003Eg__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task\u00601 baseUriTask, CancellationToken applicationStoppingToken, Boolean proxy404s)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task\u00601 baseUriTask, CancellationToken applicationStoppingToken, Boolean proxy404s)
   at Microsoft.AspNetCore.Builder.SpaProxyingExtensions.\u003C\u003Ec__DisplayClass2_0.\u003C\u003CUseProxyToSpaDevelopmentServer\u003Eb__0\u003Ed.MoveNext()
--- End of stack trace from previous location ---
   at NetPad.Middlewares.ExceptionHandlerMiddleware.InvokeAsync(HttpContext httpContext) in /home/tips/Source/TIPS/NetPad/src/Apps/NetPad.Apps.App/Middlewares/ExceptionHandlerMiddleware.cs:line 30
tareqimbasher commented 8 months ago

It looks like you have an environment variable telling .NET that you're running in Development mode. You probably have ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT defined with the value Development.

I'll add a fix for this so NetPad ignores these environment variables, for now however, you can either remove that env var, or change its value to a different value, ex: Production

lexarchik commented 8 months ago

Thanks! Indeed I have ASPNETCORE_ENVIRONMENT set to Development :)