Discussion: How should we use service discovery in Blazor WASM?
See original GitHub issueI was building out a sample that I wanted to contribute via PR. The sample would have a Blazor WASM frontend and a simple Web API backend.
As with the angular sample, I was forced to hard-code the ports so I could know how to call the API on the back-end. The Blazor WASM project runs client-side, so it wouldn’t have access to the server-side configuration settings unless I hosted it in an ASP.NET Core project complicating the sample.
I know hard-coding for client-side apps is the reality now, but is there any plans to ease this minor pain? I saw some issues mention generating constants use a source generator, but that didn’t seem to be in progress.
BTW: The GetServiceUri
extension method works well server-side and that was a great addition.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:7 (1 by maintainers)
Top Results From Across the Web
On .NET Episode: Microservice Service Discovery with Steeltoe
NET community is currently discussing the use of dotnet-script for C# scripting and exploring the combination of Blazor WebAssembly and .NET MVC ...
Read more >Blazor WebAssembly standalone - Authentication and ...
On this post I will discuss about implementing authentication on a Blazor WebAssembly standalone app via OpenID Connect(OIDC) using ...
Read more >Building Blazor WASM client applications
If you are building Blazor WASM apps that do not deal with sensitive data and you want to use the no-backend approach, have...
Read more >Using DNS for REST Web Service Discovery - InfoQ
Jan Algermissen explains the need for discovery of RESTful services, and explains how the existing Domain Name Service (DNS) standard can be ...
Read more >ASP.NET Core Blazor dependency injection
Learn how Blazor apps can inject services into components.
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 FreeTop 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
Top GitHub Comments
Client-side apps are different due to being executed on the client. I think that you either have to request it from the orchestrator somehow or inject it at build time.
Ideally, there would be an API endpoint which the client-side app would request configuration from. Tye could provide that endpoint.
@robertsundstrom hit the nail on the head here; either we need to inject it at build time, which requires knowing about a publicly exposed ingress endpoint, or setup a service/api.
I’m not sure which solution is better here though.