简体   繁体   English

vscode调试返回“处理请求时发生未处理的异常”

[英]vscode debugging returns “An unhandled exception occurred while processing the request”

I am trying to debug a dotnet react app. 我正在尝试调试dotnet react应用。 "dotnet run" works fine. “ dotnet运行”可以正常工作。 However, debugging my dotnet react app on vscode returns "conntection refused at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task<Uri> baseUriTask, CancellationToken applicationStoppingToken, bool proxy404s) " 但是,在vscode上调试我的dotnet react应用程序将返回“ Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task<Uri> baseUriTask, CancellationToken applicationStoppingToken, bool proxy404s)

The application I am making has a dotnet core backend and react as the front end which is made possible by microsoft spa services. 我正在制作的应用程序具有dotnet核心后端,并作为前端响应,这是Microsoft spa服务使之成为可能的。 I have tried many fixes that have worked for others such as upgrading my dotnet-sdk but I still get the issue. 我已经尝试了许多对其他人有用的修复程序,例如升级dotnet-sdk,但仍然遇到问题。

Here are my launch.json configurations 这是我的launch.json配置

{
            "name": ".NET Core Launch (web)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            // If you have changed target frameworks, make sure to update the program path.
            "program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/debate.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            "stopAtEntry": false,
            // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
            "serverReadyAction": {
                "action": "openExternally",
                "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"                
            },
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            },
            "sourceFileMap": {
                "/Views": "${workspaceFolder}/Views"
            }
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]```


This is my build task

```"tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [

                "build",
                "${workspaceFolder}/debate.csproj"
            ],
            "problemMatcher": "$tsc"
        }

In my startup.cs i cannot debug past this line spa.UseReactDevelopmentServer(npmScript: "start"); 在我的startup.cs中,我无法调试通过此行spa.UseReactDevelopmentServer(npmScript: "start");

Here is the error message a recieve 这是收到的错误消息


fail: Microsoft.AspNetCore.SpaServices[0]
      events.js:183

Microsoft.AspNetCore.SpaServices:Error: events.js:183

fail: Microsoft.AspNetCore.SpaServices[0]
            throw er; // Unhandled 'error' event

And on the browser, I get 在浏览器上

System.Net.Http.ConnectHelper.ConnectAsync(string host, int port, CancellationToken cancellationToken)
System.Threading.Tasks.ValueTask<TResult>.get_Result()
System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
System.Threading.Tasks.ValueTask<TResult>.get_Result()
System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask<ValueTuple<HttpConnection, HttpResponseMessage>> creationTask)
System.Threading.Tasks.ValueTask<TResult>.get_Result()
System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, bool doRequestAuth, CancellationToken cancellationToken)
System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task<HttpResponseMessage> sendTask, HttpRequestMessage request, CancellationTokenSource cts, bool disposeCts)
Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task<Uri> baseUriTask, CancellationToken applicationStoppingToken, bool proxy404s)```

I was able to reproduce the error 'dotnet run' instead of 'sudo donet run'.

I noticed that the node proccess doesnt end even after I stop debugging. 我注意到即使停止调试,节点处理也不会结束。 So ending it manually using killall node before I start another debugging session stopped producing the error. 因此,在启动另一个调试会话之前,使用killall节点手动结束它会停止产生该错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在mvc中处理请求时发生未处理的异常 - An unhandled exception occurred while processing the request in mvc 处理请求时发生未处理的异常 - ASP .NET Core - An unhandled exception occurred while processing the request- ASP .NET Core 处理请求时发生未处理的异常。 当我想按类别列出产品时出现此错误? - An unhandled exception occurred while processing the request. I got this error when I wanted to list the products by category? 添加Category ViewModel.后,处理请求时发生未处理的异常 - After adding Category ViewModel., An unhandled exception occurred while processing the request 处理请求时发生未处理的异常。 NullReferenceException:Object 引用未设置为 object 的实例 - An unhandled exception occurred while processing the request. NullReferenceException: Object reference not set to an instance of an object “处理您的请求时发生异常。 此外,在执行自定义错误页面时发生了另一个异常……” - “An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page…” 当前Web请求“Ненайденуказанныймодуль”的执行期间发生未处理的异常 - An unhandled exception occurred during the execution of the current web request, “Не найден указанный модуль” 处理您的请求时发生错误。 MVC 4 - An error occurred while processing your request. MVC 4 调试未处理的HTTP请求到WebAPI - Debugging unhandled HTTP request to WebAPI 当前Web请求的执行期间发生未处理的异常。 型号兼容性无法检查 - An unhandled exception occurred during the execution of the current web request. Model compatibility cannot be checked
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM