Dashes in a hosted Blazor WebAssembly project name break OIDC security
See original GitHub issueDescribe the bug
I have created multiple Blazor WASM apps with ASP.NET hosting and Individual Authentication from the base template, but none of them run upon initial creation. I always get the following error:
It doesn’t happen with Standalone Blazor WASM apps with Individual Authentication and it doesn’t happen with Blazor WASM apps with ASP.NET Hosting and NO authentication. Just when both are used.
The Client project is created fine and exists in the solution. I don’t know why the Server project can’t find it.
To Reproduce
- Open Visual Studio 2019 and select Create New Project.
- Select Blazor WebAssembly App project Template.
- Enter a name for the project.
- Check the ASP.Net Hosted option box.
- Select Individual Authentication for the Authentication type.
- Create Project.
- Wait for Solution to load then run Server project.
- Browser opens and shows a partial Blazor page then the Exception is hit.
Exceptions (if any)
System.InvalidOperationException: Client 'Blazor-WASM-Hosted-Auth-Demo.Client not found
Further technical details
- ASP.NET Core version 5.0
-
- Visual Studio 2019 16.11.0
- Output of
dotnet --info
.NET SDK (reflecting any global.json):
Version: 5.0.400
Commit: d61950f9bf
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.400\
Host (useful for support):
Version: 5.0.9
Commit: 208e377a53
.NET SDKs installed:
3.1.412 [C:\Program Files\dotnet\sdk]
5.0.302 [C:\Program Files\dotnet\sdk]
5.0.400 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
cc: @guardrex
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Secure a hosted ASP.NET Core Blazor WebAssembly app ...
Avoid using dashes ( - ) in the app name that break the formation of the OIDC app identifier (see the earlier WARNING)....
Read more >Blazor webassembly tutorial net 7. We also have ...
Avoid using dashes (-) in the project name that break the formation of the … In this video, I have explained the complete...
Read more >Blazor manualresetevent. Close [] This method is the public ...
When running a hosted Blazor WebAssembly solution in Visual Studio, ... Avoid using dashes (-) in the project name that break the formation...
Read more >How to Build Securely with Blazor WebAssembly (WASM)
Set the Project name to “Okta Blazor WASM” and click Create. Select Blazor WebAssembly App and check Progressive Web Application. We are ...
Read more >How to Build and Secure Web Applications with Blazor
Learn how to build client-side Web apps using Blazor and how to secure them with Auth0 authentication and authorization features.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We don’t plan on changing the behavior since the workaround is trivial. A bot usually closes resolved issues after it gives the users time to respond.
I tried both
BlazorWasmHostedAuthDemo
andBlazor_Wasm_Hosted_Auth_Demo
as project names and those both worked fine. It definitely doesn’t like the dashes then.