emonney / QuickApp

ASP.NET Core / Angular startup project template with complete login, user and role management. Plus other useful services for Quick Application Development
https://www.ebenmonney.com/quickapp
MIT License
1.26k stars 594 forks source link

401 Auth error when clicking the setting icon after login when deploy to IIS #167

Closed Reagang closed 1 year ago

Reagang commented 4 years ago

I'm getting 401 error when after I login as Admin and click on setting icon. It works fine on IIS express(running Visual studio) but not working when I try to run it on IIS to test. I saw a lot of comments that mention Application Url and SSL port. I tried changing it but it's not working.

image

image

Reagang commented 4 years ago

This seems to be related to IdentityServer4. dbug: IdentityServer4.Endpoints.TokenEndpoint[0] Token request success. fail: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[3] Exception occurred while processing message. System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'http://localhost:5055/.well-known/openid-configuration'. at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync() fail: IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler[0]

karkcoder commented 3 years ago

can you post your launchsetting.json?

Reagang commented 3 years ago

launchsetting.json

{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iis": { "applicationUrl": "https://localhost:44350", "sslPort": 0 }, "iisExpress": { "applicationUrl": "http://localhost:5050", "sslPort": 44350 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "MyApp": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:5001;http://localhost:5002" } } }

karkcoder commented 3 years ago

I think you might have similar issue like this post https://github.com/emonney/QuickApp/issues/150

Make sure the port on your launchssetting and appsetting match. That was how I fixed it.

kmuthugtk commented 3 years ago

Hi,

The same errors, i am facing. please guide me to solve. Here i attached the launchsetting.json and appsettings.json

launchsetting.json

{ "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:52488", "sslPort": 44310 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "GTK": { "commandName": "Project", "dotnetRunMessages": "true", "launchBrowser": true, "launchUrl": "swagger", "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } }

appsettings.json

{ "ConnectionStrings": { "DefaultConnection": "Server=localhost;User ID=sa;Password=123;Database=QuickApp;" },

//Note: In Production change this to your actual host "ApplicationUrl": "http://localhost:5000", "https_port": 5001, //Set this for https redirection (e.g. 443) }

how can i fixed this issues? let me know

malekdahmeni1 commented 3 years ago

my freinsd.plz any solution for that?

Mynken commented 3 years ago

@thomas1008 Check ApplicationUrl in appsetting.json