VS 2019 和 VS 2022 中的 ASP.NET Core 3.1 项目 - 启动而不调试失败 - HTTP 错误 500.30 - ANCM 进程内启动失败

问题描述 投票:0回答:2

将 VS 2022 升级到最新的 .NET 8 后,我无法

Start Without Debugging
VS 2019 中的任何 ASP.NET Core 3.1 项目。相同的项目 (ASP.NET Core 3.1) 也无法在 VS 2022 中启动。开始调试(F5)仍然有效。

这是事件管理器中的错误详细信息:

浏览器(MS Edge)错误是:

我的 VS 2019 Community 安装是这样的:

    Microsoft Visual Studio Community 2019
Version 16.11.32
VisualStudio.16.Release/16.11.32+34301.259
Microsoft .NET Framework
Version 4.8.09037

Installed Version: Community

Microsoft Visual Studio Tools for Applications 2019   00435-00000-00000-AA703
Microsoft Visual Studio Tools for Applications 2019

Visual C++ 2019   00435-00000-00000-AA703
Microsoft Visual C++ 2019

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools 2019   16.11.116.46506
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019   16.11.116.46506
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.11.116.46506
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.6.3000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   16.11.116.46506
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.3000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   3.11.0-4.22108.8+d9bef045c4362fbcab27ef35daec4e95c8ff47e1
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter   16.11.21196.2
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

GitHub.VisualStudio   2.11.106.19330
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node   2.6.3000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.6.3000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   16.10
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.6.3000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.126+g11d4cf0d0c.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers   1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   16.10.15 (552afdf)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.5.30526.3 Commit Hash:c09c81113bcbc86d57943fcdd67e82434263d61d
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   5.11.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Office Developer Tools for Visual Studio   16.0.31424.03
Microsoft Office Developer Tools for Visual Studio

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Python   16.11.21196.2
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Python - Conda support   16.11.21196.2
Conda support for Python projects.

Python - Django support   16.11.21196.2
Provides templates and integration for the Django web framework.

Python - Profiling support   16.11.21196.2
Profiling support for Python projects.

Razor (ASP.NET Core)   16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   16.0.62205.05200
Microsoft SQL Server Data Tools

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   16.0.30526.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.11.0-4.22108.8+d9bef045c4362fbcab27ef35daec4e95c8ff47e1
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   16.11.0-beta.21514.6+b6c2c4f53ea3a08fa603ea93d6d2f808a62a21d1
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for CMake   1.0
Visual Studio Tools for CMake

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes   1.0
Visual Studio Tools for Kubernetes

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Foo   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   16.11.000.204 (d16-11@8671d2f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.11.0.47 (remotes/origin/d16-11@e0d612363)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.10.5 (355b57a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   12.0.0.3 (d16-11/f0e3c2d)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: c633fe9
    Java.Interop: xamarin/java.interop/d16-11@476bb5b
    ProGuard: Guardsquare/proguard/v7.0.1@912d149
    SQLite: xamarin/sqlite/3.35.4@85460d3
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-11@87af37b


Xamarin.iOS and Xamarin.Mac SDK   15.2.0.17 (738fde344)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

我的 VS 2022 Community 安装是这样的:

Microsoft Visual Studio Community 2022
Version 17.8.0
VisualStudio.17.Release/17.8.0+34309.116
Microsoft .NET Framework
Version 4.8.09037

Installed Version: Community

Visual C++ 2022   00482-90000-00000-AA748
Microsoft Visual C++ 2022

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools   17.8.352.38654
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.8.352.38654
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio   2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   17.8.352.38654
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

Bundler & Minifier   2.9.9
Adds support for bundling and minifying JavaScript, CSS and HTML files in any project.

C# Tools   4.8.0-7.23558.1+e091728607ca0fc9efca55ccfb3e59259c6b5a0a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter   17.0.23262.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

Extensibility Message Bus   1.4.39 (main@e8108eb)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft Azure Hive Query Language Service   2.6.5000.0
Language service for Hive query

Microsoft Azure Stream Analytics Language Service   2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.8.17 (957fbed)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   6.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Office Developer Tools for Visual Studio   17.6.34024.01
Microsoft Office Developer Tools for Visual Studio

Python - Django support   17.0.23262.1
Provides templates and integration for the Django web framework.

Python - Profiling support   17.0.23262.1
Profiling support for Python projects.

Python - VC Project Support   17.0.23055.1
Provides support for launching C++ projects with Python debugging enabled.

Python with Pylance   17.0.23262.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Razor (ASP.NET Core)   17.8.3.2353105+f0a326f3e15b2370371693a76fd379635387c74d
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.8.119.0
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   17.0.20920.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.8.0-7.23558.1+e091728607ca0fc9efca55ccfb3e59259c6b5a0a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSPackage Extension   1.0
VSPackage Visual Studio Extension Detailed Info

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   17.8.0.155 (d17-8@7042beb)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.8.3.6 (remotes/origin/d17-8@eccf46a291)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   17.8.16 (830b56a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   13.2.2.0 (d17-5/45b0e14)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: d9a6e87
    Java.Interop: xamarin/java.interop/d17-5@149d70fe
    SQLite: xamarin/sqlite/3.40.1@68c69d8
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d


Xamarin.iOS and Xamarin.Mac SDK   16.4.0.23 (9defd91b3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

我还在 VS 2019 中创建了一个全新的 ASP.NET Core 3.1 项目,形成可用模板。不调试就启动也行不通。

web.config
文件中我启用了
stdoutLogEnabled

    <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\TEST_WebApplication.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
        <handlerSettings>
          <handlerSetting name="debugFile" value=".\logs\aspnetcore-debug.log" />
          <handlerSetting name="debugLevel" value="FILE,TRACE" />
        </handlerSettings>
      </aspNetCore>
    </system.webServer>
  </location>

日志文件是:

    [2023-11-19T08:29:18.793Z, PID: 24964] [aspnetcorev2.dll] Initializing logs for 'C:\Program Files\IIS Express\Asp.Net Core Module\V2\aspnetcorev2.dll'. Process Id: 24964. File Version: 17.0.22116.0. Description: IIS ASP.NET Core Module V2. Commit: bd6dbc1f547a28d02fadfe082936e77e56b61a4e.
[2023-11-19T08:29:18.800Z, PID: 24964] [aspnetcorev2.dll] Resolving hostfxr parameters for application: 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\TEST_WebApplication.exe' arguments: '.\TEST_WebApplication.dll' path: 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\'
[2023-11-19T08:29:18.803Z, PID: 24964] [aspnetcorev2.dll] Known dotnet.exe location: ''
[2023-11-19T08:29:18.805Z, PID: 24964] [aspnetcorev2.dll] Process path 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\TEST_WebApplication.exe' is not dotnet, treating application as standalone or portable with bootstrapper
[2023-11-19T08:29:18.810Z, PID: 24964] [aspnetcorev2.dll] Checking application.dll at 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\TEST_WebApplication.dll'
[2023-11-19T08:29:18.813Z, PID: 24964] [aspnetcorev2.dll] Checking hostfxr.dll at 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\hostfxr.dll'
[2023-11-19T08:29:18.817Z, PID: 24964] [aspnetcorev2.dll] hostfxr.dll not found at 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\hostfxr.dll', treating application as portable with launcher
[2023-11-19T08:29:18.819Z, PID: 24964] [aspnetcorev2.dll] Resolving absolute path to dotnet.exe from 'dotnet'
[2023-11-19T08:29:18.822Z, PID: 24964] [aspnetcorev2.dll] Invoking where.exe to find dotnet.exe
[2023-11-19T08:29:19.198Z, PID: 24964] [aspnetcorev2.dll] where.exe invocation returned: 'C:\Program Files\dotnet\dotnet.exe
'
[2023-11-19T08:29:19.205Z, PID: 24964] [aspnetcorev2.dll] Current process bitness type detected as isX64=1
[2023-11-19T08:29:19.207Z, PID: 24964] [aspnetcorev2.dll] Processing entry 'C:\Program Files\dotnet\dotnet.exe'
[2023-11-19T08:29:19.209Z, PID: 24964] [aspnetcorev2.dll] Binary type 6
[2023-11-19T08:29:19.212Z, PID: 24964] [aspnetcorev2.dll] Found dotnet.exe via where.exe invocation at 'C:\Program Files\dotnet\dotnet.exe'
[2023-11-19T08:29:19.214Z, PID: 24964] [aspnetcorev2.dll] hostfxr.dotnet_root: 'C:\Program Files\dotnet'
[2023-11-19T08:29:19.216Z, PID: 24964] [aspnetcorev2.dll] hostfxr.assembly_path: 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\'
[2023-11-19T08:29:19.219Z, PID: 24964] [aspnetcorev2.dll] Parsed hostfxr options: dotnet location: 'C:\Program Files\dotnet\dotnet.exe' hostfxr path: 'C:\Program Files\dotnet\host\fxr\8.0.0\hostfxr.dll' arguments:
[2023-11-19T08:29:19.222Z, PID: 24964] [aspnetcorev2.dll] Argument[0] = 'C:\Program Files\dotnet\dotnet.exe'
[2023-11-19T08:29:19.223Z, PID: 24964] [aspnetcorev2.dll] Argument[1] = 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\TEST_WebApplication.dll'
[2023-11-19T08:29:19.224Z, PID: 24964] [aspnetcorev2.dll] Argument[2] = '.\TEST_WebApplication.dll'
[2023-11-19T08:29:19.226Z, PID: 24964] [aspnetcorev2.dll] Loading hostfxr from location C:\Program Files\dotnet\host\fxr\8.0.0\hostfxr.dll
[2023-11-19T08:29:19.329Z, PID: 24964] [aspnetcorev2.dll] Canceling standard stream pipe reader
[2023-11-19T08:29:19.335Z, PID: 24964] [aspnetcorev2.dll] Loading request handler:  'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.32\aspnetcorev2_inprocess.dll'
[2023-11-19T08:29:19.339Z, PID: 24964] [aspnetcorev2.dll] Creating handler application

    [aspnetcorev2_inprocess.dll] Initializing logs for 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.32\aspnetcorev2_inprocess.dll'. Process Id: 24964.. File Version: 13.1.22321.32. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: 3eeb12e106b9e913c3a4dec1a7d16da7b74149eb.
[aspnetcorev2_inprocess.dll] Waiting for initialization
[aspnetcorev2_inprocess.dll] Starting in-process worker thread
[aspnetcorev2_inprocess.dll] Resolving hostfxr parameters for application: 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\TEST_WebApplication.exe' arguments: '.\TEST_WebApplication.dll' path: 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\'
[aspnetcorev2_inprocess.dll] Known dotnet.exe location: 'C:\Program Files\dotnet\dotnet.exe'
[aspnetcorev2_inprocess.dll] Process path 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\TEST_WebApplication.exe' is not dotnet, treating application as standalone or portable with bootstrapper
[aspnetcorev2_inprocess.dll] Checking application.dll at 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\TEST_WebApplication.dll'
[aspnetcorev2_inprocess.dll] Checking hostfxr.dll at 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\hostfxr.dll'
[aspnetcorev2_inprocess.dll] hostfxr.dll found app local at 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\hostfxr.dll', treating application as portable with launcher
[aspnetcorev2_inprocess.dll] Resolving absolute path to hostfxr.dll from 'C:\Program Files\dotnet\dotnet.exe'
[aspnetcorev2_inprocess.dll] hostfxr.dll located at 'C:\Program Files\dotnet\host\fxr\8.0.0\hostfxr.dll'
[aspnetcorev2_inprocess.dll] Parsed hostfxr options: dotnet location: 'C:\Program Files\dotnet\dotnet.exe' hostfxr path: 'C:\Program Files\dotnet\host\fxr\8.0.0\hostfxr.dll' arguments:
[aspnetcorev2_inprocess.dll] Argument[0] = 'C:\Program Files\dotnet\dotnet.exe'
[aspnetcorev2_inprocess.dll] Argument[1] = 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\bin\Debug\netcoreapp3.1\TEST_WebApplication.dll'
[aspnetcorev2_inprocess.dll] Argument[2] = '.\TEST_WebApplication.dll'
[aspnetcorev2_inprocess.dll] Setting environment variable ASPNETCORE_IIS_HTTPAUTH=anonymous;
[aspnetcorev2_inprocess.dll] Setting environment variable ASPNETCORE_IIS_PHYSICAL_PATH=C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\
[aspnetcorev2_inprocess.dll] Loading hostfxr from location C:\Program Files\dotnet\host\fxr\8.0.0\hostfxr.dll
[aspnetcorev2_inprocess.dll] Initial Dll directory: 'C:\Program Files\IIS Express', current directory: 'C:\Program Files\IIS Express'
[aspnetcorev2_inprocess.dll] Setting current directory to C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\
[aspnetcorev2_inprocess.dll] Managed threw an exception -532462766
[aspnetcorev2_inprocess.dll] Starting shutdown sequence 1
[aspnetcorev2_inprocess.dll] Clr thread wait ended: clrThreadExited: 1
[aspnetcorev2_inprocess.dll] Canceling standard stream pipe reader
[aspnetcorev2_inprocess.dll] Event Log: 'Application '/LM/W3SVC/2/ROOT' with physical root 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\' hit unexpected managed exception, exception code = '0xe0434352'. Please check the stderr logs for more information.' 
End Event Log Message.
[aspnetcorev2_inprocess.dll] Stopping in-process worker thread
[aspnetcorev2_inprocess.dll] Stopping CLR
[aspnetcorev2_inprocess.dll] Event Log: 'Application '/LM/W3SVC/2/ROOT' with physical root 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\' failed to load coreclr. Exception message:
CLR worker thread exited prematurely' 
End Event Log Message.
[aspnetcorev2_inprocess.dll] InvalidOperationException 'CLR worker thread exited prematurely' caught at D:\a\_work\1\s\src\Servers\IIS\AspNetCoreModuleV2\InProcessRequestHandler\inprocessapplication.cpp:420 
[aspnetcorev2_inprocess.dll] Failed HRESULT returned: 0x8007023e at D:\a\_work\1\s\src\Servers\IIS\AspNetCoreModuleV2\InProcessRequestHandler\dllmain.cpp:131 
[aspnetcorev2_inprocess.dll] Starting app_offline monitoring in application 'C:\Users\MARCO\Documents\Visual Studio 2019\Projects\TEST_WebApplication\TEST_WebApplication\'
[aspnetcorev2_inprocess.dll] Starting file watcher thread

我还尝试在

global.json
文件中设置使用的SDK版本:

{
  "sdk": {
    "version": "3.1.426",
    "rollForward": "disable"
  }
}

但这并没有帮助。

Program.cs
文件中我也声明要像这样使用IIS:

public class Program
{
    public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder
                .UseIISIntegration()
                .UseIIS()
                .UseStartup<Startup>();
            });
}

我的最后一次尝试是使用

dotnet run
从命令行启动项目。 在这种情况下,它可以工作,可以在
https://localhost:5001/
下访问该网站,而不是在项目属性中指示的端口下访问。

dotnet --info output is:

    C:\Users\MARCO>dotnet --info
.NET SDK:
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.8d38d0cc

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.100\

Installierte .NET-Workloads:
 Workload version: 8.0.100-manifests.8d38d0cc
 [android]
   Installationsquelle: VS 17.8.34309.116
   Manifestversion:    34.0.43/8.0.100
   Manifestpfad:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.43\WorkloadManifest.json
   Installationstyp:              Msi

 [wasm-tools]
   Installationsquelle: VS 17.8.34309.116
   Manifestversion:    8.0.0/8.0.100
   Manifestpfad:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain.current\8.0.0\WorkloadManifest.json
   Installationstyp:              Msi

 [ios]
   Installationsquelle: VS 17.8.34309.116
   Manifestversion:    17.0.8478/8.0.100
   Manifestpfad:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\17.0.8478\WorkloadManifest.json
   Installationstyp:              Msi

 [maui-windows]
   Installationsquelle: VS 17.8.34309.116
   Manifestversion:    8.0.3/8.0.100
   Manifestpfad:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.3\WorkloadManifest.json
   Installationstyp:              Msi

 [maccatalyst]
   Installationsquelle: VS 17.8.34309.116
   Manifestversion:    17.0.8478/8.0.100
   Manifestpfad:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\17.0.8478\WorkloadManifest.json
   Installationstyp:              Msi


Host:
  Version:      8.0.0
  Architecture: x64
  Commit:       5535e31a71

.NET SDKs installed:
  1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
  1.0.4 [C:\Program Files\dotnet\sdk]
  1.1.0 [C:\Program Files\dotnet\sdk]
  1.1.7 [C:\Program Files\dotnet\sdk]
  2.0.0 [C:\Program Files\dotnet\sdk]
  2.0.2 [C:\Program Files\dotnet\sdk]
  2.0.3 [C:\Program Files\dotnet\sdk]
  2.1.2 [C:\Program Files\dotnet\sdk]
  2.1.4 [C:\Program Files\dotnet\sdk]
  2.1.100 [C:\Program Files\dotnet\sdk]
  2.1.617 [C:\Program Files\dotnet\sdk]
  2.1.700 [C:\Program Files\dotnet\sdk]
  2.1.818 [C:\Program Files\dotnet\sdk]
  2.2.204 [C:\Program Files\dotnet\sdk]
  2.2.300 [C:\Program Files\dotnet\sdk]
  2.2.401 [C:\Program Files\dotnet\sdk]
  2.2.402 [C:\Program Files\dotnet\sdk]
  3.1.426 [C:\Program Files\dotnet\sdk]
  5.0.103 [C:\Program Files\dotnet\sdk]
  5.0.104 [C:\Program Files\dotnet\sdk]
  5.0.202 [C:\Program Files\dotnet\sdk]
  5.0.214 [C:\Program Files\dotnet\sdk]
  5.0.302 [C:\Program Files\dotnet\sdk]
  5.0.303 [C:\Program Files\dotnet\sdk]
  5.0.402 [C:\Program Files\dotnet\sdk]
  5.0.408 [C:\Program Files\dotnet\sdk]
  5.0.416 [C:\Program Files\dotnet\sdk]
  8.0.100 [C:\Program Files\dotnet\sdk]

如有任何帮助,我们将不胜感激。

asp.net-core visual-studio-2019 visual-studio-2022 .net-core-3.1 .net-8.0
2个回答
1
投票

我也遇到了同样的问题,几个小时后找到了解决方案。

转到命令提示符并键入

dotnet --list-sdks

即使我的 dotnet --info 返回所有 API 和 SDK,上述命令也仅显示 6.0.417 和 8.0.100。

再次安装3.1 sdk并没有解决问题。最后我不得不去 https://dotnet.microsoft.com/en-us/download/dotnet/3.1 并下载 x64 二进制文件。然后我从二进制zip文件中取出3.1.426文件夹并将其放入c:\program files\dotnet\sdk

完成此调试后,VS2022 和 dotnet core 3.1 项目再次正常工作。


0
投票

将我的 Visual Studio Community 2022 升级到版本 17.9.0 后,问题消失了。 ASP.NET Core 3.1 应用程序可以正常工作,我可以从 VS 2019 和 VS 2022 启动它们,无论是否进行调试,都不会再出现任何问题。

© www.soinside.com 2019 - 2024. All rights reserved.