具有个人帐户和 ASP.NET 核心托管的 Blazor WebAssembly 应用程序 - IIS - SQLLocalDB 15.0 找不到指定的资源语言 ID

Blazor WebAssembly App with Individual Accounts and ASP.NET Core Hosted - IIS - SQLLocalDB 15.0 The specified resource language ID cannot be found

正在使用 Microsoft Visual Studio 2019 Version 16.9.4 创建一个新的 Blazor WebAssembly App 并使用这些规范:Target Framework .NET 5.0Authentication Type Individual AccountsASP.NET Core Hosted

没有任何修改,我只是通过 IIS Express、运行 迁移开始了项目,并向数据库添加了一个用户。

这没有问题,所以我创建了一个发布配置文件到文件夹。

然后我在 IIS 中设置了一个新站点,版本 10.0.19041.1,并将应用程序池设置为使用我的 Windows 身份,我已经确认它可以与 SSMS 一起使用,并且可以通过 IIS Express.

运行 这是我第一次在 Windows 日志中收到此错误:

System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderConfigurationExtensions.<>c.b__10_2(IServiceProvider sp)

我通过在 appsettings.json 中向 IdentityServer 添加 Key 来解决这个问题,就像 appsettings.Development.json 所做的那样:

"Key": {
  "Type": "Development"
}

在此之后我收到以前从未见过的错误:

SQLLocalDB 15.0 Windows API call WaitForMultipleObjects returned error code: 575. Windows system error message is: {Application Error} The application was unable to start correctly (0x%lx). Click OK to close the application. Reported at line: 3714.

SQLLocalDB 15.0 Windows API call FormatMessageW returned error code: 1815. Windows system error message is: The specified resource language ID cannot be found in the image file. Reported at line: 4296.

在这些错误之后是标准连接错误:

Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SNI_PN11, error: 50 - Local Database Runtime error occurred. Error occurred during LocalDB instance startup: SQL Server process failed to start.

应用程序池使用我用于登录 SSMS 并运行 IIS Express 的同一身份。我以前使用 LocalDB 13.1 使它像这样工作,但我必须升级我的 LocalDB 才能使用 Temporal tables.

这可能是什么原因造成的?

根据@DingPeng的评论尝试分享,还是一样的错误

https://dba.stackexchange.com/a/30384/80960

检查了 %localappdata%\Microsoft\Microsoft SQL Server Local DB\Instances\mssqllocaldb 的日志。

2021-05-12 00:08:24.41 Logon Login failed for user '-\Oscar'. Reason: Failed to open the explicitly specified database 'aspnet-WebApplication7.Server-'. [CLIENT: ]

2021-05-12 00:08:25.98 spid52 Starting up database 'aspnet-WebApplication7.Server-'.

2021-05-12 00:08:26.00 spid52 Parallel redo is started for database 'aspnet-WebApplication7.Server-' with worker pool size [4].

2021-05-12 00:08:26.02 spid52 Parallel redo is shutdown for database 'aspnet-WebApplication7.Server-' with worker pool size [4].

然后我想起我实际上在 SQLLocalDB 13.0SQLLocalDB 13.1 上也有这个问题。工作到很晚的危险。

在遵循这个答案后,我验证了我的 Application PoolLoad User Profile 设置为 true,然后在 applicationHost.config 中将 setProfileEnvironment 设置为 true。我通过编辑位于以下位置的 applicationHost.config 来完成最后一部分:

C:\Windows\System32\inetsrv\config\applicationHost.config

在此之后一切正常!