【发布时间】:2021-06-02 00:42:37
【问题描述】:
我有一个 asp.net core (.net5) 项目,当我启动它时,它会在延迟后系统地抛出错误,然后关闭调试。
我有以下启动设置:
{
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:50868",
"sslPort": 44363
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Kestrel": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
我以“Kestrel”的身份在调试模式下启动项目
发生了一个或多个错误。
无法启动调试适配器。附加信息可能是 在输出窗口中可用。
无法连接到运行时进程,10000 毫秒后超时 - (原因: 无法连接到目标:连接 ECONNREFUSED 127.0.0.1:55743)。
当项目设置为在 https://localhost:5001 或 5000 启动浏览器时,它似乎确实尝试连接到像 127.0.0.1:55743 这样的随机端口
似乎与这个问题有关https://github.com/dotnet/aspnetcore/issues/28113
PS。 Edge 的调试工作正常(我通常在 Chrome 中工作),如果您遇到此类问题,我想需要更改浏览器......
【问题讨论】:
-
你在哪里看到
127.0.0.1:55743?截图中是127.0.0.1:56174。每次尝试时端口都会改变吗? -
@Vernou 是的,它每次都会改变
-
配置的端口好像很忙,不知道为什么会启动两次...更新了OP
-
检查this thread,尝试清理项目,然后在Visual Studio 2019 中禁用Asp.Net 的JavaScript 调试。或者,参考this thread,转到Visual Studio 2019 工具,然后单击选项,选择调试,然后启用调试停止时自动关闭控制台选项。
-
我观察到更改默认浏览器会有所帮助...但这是一种解决方法,而不是解决方案
标签: .net visual-studio asp.net-core visual-studio-2019 .net-5