My project is with Radzen Blazor Studio + Blazor WebAssembly + ASP.NET Core Identity
I have a problem only when deploy on IIS server. After login where Index Page with service injected fails (no error show) web and If I configure in developtment mode in Production show bellow error:
# An unhandled exception occurred while processing the request UriFormatException: Invalid URI: The hostname could not be parsed.
... Program+<>c.<$>b__0_0(IServiceProvider sp) in Program.cs** **XXXXX.Server.Pages.Pages__Host.<ExecuteAsync>b__14_1() in _Host.cshtml
In Debug IIS Express and Dotnet works fine. Only fails with IIS Server.
The code that generate error is bellow (I'm sure because when delete this code not fails):
[Inject]
public MercatService MercatService { get; set; }
MercatService is autogenerated by Radzen Blazor Studio
The best is that if I use first another url like "web:2000/unauthorized" I have no problems in navegate with panelmenu. Directly "web:2000" no works.
Incredible, after days trying, I have the solution. Maybe it was because I access the Web Server by IP instead of name:
Delete/Comment next code autogenerated by Blazor Studio in Program.cs (Server)
//builder.Services.AddSingleton(sp =>
//{
// // Get the address that the app is currently running at
// var server = sp.GetRequiredService();
// var addressFeature = server.Features.Get();
// string baseAddress = addressFeature.Addresses.First();
// return new HttpClient { BaseAddress = new Uri(baseAddress) };
//});
Works in Debug VS and Production IIS.
Thank you anyway, Radzen Blazor Studio is awesome!