Creating a new Blazor WebAssembly App
with Microsoft Visual Studio 2019 Version 16.9.4
with these specifications: Target Framework .NET 5.0
, Authentication Type Individual Accounts
and ASP.NET Core Hosted
:
With no modifications I have simply started the project with IIS Express
, ran migrations and added a user to the database.
This works without a problem so then I created a publish profile to folder.
I then set up a new site in IIS, version 10.0.19041.1, and set the Application Pool to use my Windows Identity that I have confirmed works with SSMS
and that works via IIS Express
.
Running it the first time I got this error in Windows logs:
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderConfigurationExtensions.<>c.b__10_2(IServiceProvider sp)
I fixed this by adding a Key
to IdentityServer
in appsettings.json
exactly like appsettings.Development.json
does it:
"Key": {
"Type": "Development"
}
After this I receive errors I have never seen before:
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.
After these errors there is the standard connection error:
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.
The application pool uses the same Identity that I use to sign in to SSMS
and that runs IIS Express
. I have made it work like this using LocalDB 13.1
previously but I had to upgrade my LocalDB in order to use Temporal tables
.
https://stackoverflow.com/a/64210519/3850405
What can be the cause of this?
Tried sharing based on the comment by @DingPeng but I still got the same error.
https://dba.stackexchange.com/a/30384/80960
Checked the logs at %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].
I then remembered that I actually had this problem with SQLLocalDB 13.0
and SQLLocalDB 13.1
as well. The danger of working late hours.
https://stackoverflow.com/a/62810876/3850405
After following this answer I verified that Load User Profile
was set to true for my Application Pool
and then set setProfileEnvironment
to true
in applicationHost.config
. I did the last part by editing applicationHost.config
located at:
C:\Windows\System32\inetsrv\config\applicationHost.config
After this everything worked!
User contributions licensed under CC BY-SA 3.0