Assassinbeast
Assassinbeast

Reputation: 1277

How to run Blazor WebAssembly locally with https and custom domain?

How can i run Blazor WebAssembly (client side) locally with a custom domain in https if i have a pfx certificate?

In Blazor ServerSide its easy to setup, because like a normal asp.net core application, because we have the IHostBuilder, and there we can set the https certificate path.

But what about Blazor WebAssembly ClientSide?

Upvotes: 4

Views: 12968

Answers (1)

Quango
Quango

Reputation: 13478

If you're running Blazor locally you could be doing one of three things:

  1. Running directly from the file system, e.g. opening index.html in the browser. You can't apply TLS (SSL) here because there is no server to decode the requests and encode the responses

  2. Running on a local IISExpress server, e.g. via Visual Studio

  3. Running the Kestrel server, e.g. via dotnet run

In either (2) or (3) you need a local development certificate. This is exactly the same as any other ASP.NET Core application. It used to be hard but these days Visual Studio will help you out with this when you first run the app.

If you need to set one up, Scott Hanselmann has a useful guide on doing this.

Upvotes: 5

Related Questions