question

scixing-3244 avatar image
0 Votes"
scixing-3244 asked lextm commented

Blazor WebAssembly hosted app with Identity Server, GET https://{DOMAIN}/.well-known/openid-configuration 404


I set up a blazorwasm application, It can work normally locally(OIDC), But if I publish to the server,It does not work with a domain name(if use IP, work normally ) I checked F12 and found GET https://{DOMAIN}/.well-known/openid-configuration 404 (use IP is 200) Are there any settings needed here?
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseMySQL(
Configuration.GetConnectionString("DefaultConnection")));

         services.AddDatabaseDeveloperPageExceptionFilter();
         services.AddCors(options =>
         {
             options.AddDefaultPolicy(
             builder =>
             {
                 builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod();
             });
         });
         services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
             .AddEntityFrameworkStores<ApplicationDbContext>();
    
         services.AddIdentityServer()
             .AddApiAuthorization<ApplicationUser, ApplicationDbContext>();
    
         services.AddAuthentication()
             .AddIdentityServerJwt()
         services.AddControllersWithViews();
         services.AddRazorPages();
     }
    
     // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
     public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
     {
         if (env.IsDevelopment())
         {
             app.UseDeveloperExceptionPage();
             app.UseMigrationsEndPoint();
             app.UseWebAssemblyDebugging();
         }
         else
         {
             app.UseExceptionHandler("/Error");
             // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
             app.UseHsts();
         }
    
         app.UseHttpsRedirection();
         app.UseBlazorFrameworkFiles();
         app.UseStaticFiles();
    
         app.UseCors();
    
         app.UseRouting();
         app.UseCookiePolicy(new CookiePolicyOptions
         {
             MinimumSameSitePolicy = Microsoft.AspNetCore.Http.SameSiteMode.Lax,
         });
         app.UseIdentityServer();
         app.UseAuthentication();
         app.UseAuthorization();
    
         app.UseEndpoints(endpoints =>
         {
             endpoints.MapRazorPages();
             endpoints.MapControllers();
             endpoints.MapFallbackToFile("index.html");
         });
     }
dotnet-csharpdotnet-aspnet-core-blazor
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers