C
C#8mo ago
mylaff

[SOLVED] IdentityServer scaffolded UI from quickstart does not seem to work

Currently learning ASP.NET Core ecosystem, and as part of the process, I tried to introduce Duende IdentityServer to the system, according to their quickstart guide. However, on the second tutorial "Interactive applications with ASP.NET Core", I ran into a problem of not being able to add UI (Razor pages driven). Tutorial itself is as plain and simple as run dotnet new isui template, and then uncomment few lines which add required services and make use of them (specifically speaking app.MapRazorPages()), however, nothing seem to work, as root path / returns 404, as every other razor page. IdentityServer itself works though, and serves /.well-known/. Options tried: a) Read everything few more times b) Reorder AddService and UseService few times to no awail (they go in correct order, AFAIK) c) Ensure pages and other scaffolded template content does exist in the /Pages folder and wwwroot. d) Rebuild everything few times e) Follow video-tutorial on Duende YT Have anyone had something like this? For context, current HostingExtensions.cs (some parts are ommited for brevity):
public static WebApplication ConfigureServices(this WebApplicationBuilder builder) {
builder.Services.AddRazorPages();
builder.Services.AddIdentityServer(options => { ... });
return builder.Build();
}

public static WebApplication ConfigurePipeline(this WebApplication app) {
app.UseStaticFiles();
app.UseRouting();

app.UseIdentityServer();

app.UseAuthorization();
app.MapRazorPages().RequireAuthorization();
}
public static WebApplication ConfigureServices(this WebApplicationBuilder builder) {
builder.Services.AddRazorPages();
builder.Services.AddIdentityServer(options => { ... });
return builder.Build();
}

public static WebApplication ConfigurePipeline(this WebApplication app) {
app.UseStaticFiles();
app.UseRouting();

app.UseIdentityServer();

app.UseAuthorization();
app.MapRazorPages().RequireAuthorization();
}
1 Reply
mylaff
mylaffOP8mo ago
This indeed looks like problem with Map, for some reason, since app.MapGet("/") works perfectly fine and returns content as defined. However app.MapRazorPages() seems not to map anything at all. Trying to investigate that, altough not much to be found yet. Okay, the reason behind was that Razor Pages didn't work on my system altogether. Which is interesting in it self, as every other ASP.Net thing would work. Issue was, as I had last .Net Core version (8.0.2), my Visual Studio was a vew minor versions behind. Updating VS solved everything. That is really weird, imo, since I had to have another machine (which I happily had) just to check whether pages would work on given .Net Core version. Seemse like VS is really important in .Net build process enough so it would just silently drop any version mismatch. Weird flex but welp.
Want results from more Discord servers?
Add your server