question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discussion: How should we use service discovery in Blazor WASM?

See original GitHub issue

I 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:open
  • Created 3 years ago
  • Reactions:6
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
marinasundstromcommented, Jul 17, 2020

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.

2reactions
jkotalikcommented, Nov 5, 2020

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found