jasontaylordev / CleanArchitecture

Clean Architecture Solution Template for ASP.NET Core
MIT License
16.84k stars 3.62k forks source link

[Feature Request] Opt out of Identity Server, or include docker support #66

Closed SuliemanMansouri closed 4 years ago

SuliemanMansouri commented 4 years ago

I love the template for all the work done on mapping, testing, and CQRS. But when I tried to make the template work on local IIS I ran into lots of problems.

Right now I have to generate a certificate and add it to local store, fiddle with appsittings.json to include a key to the certificate. When all this is done I end up with an application that is stuck in login screen entering login information does nothing.

What is frustrating is it works in debug when running it using visual studio, so I know that my problem is IIS configuration related.

My request is this; is there a way to opt out of Identity server to work with the application in local intranet without authorization and authentication? Or Add docker support so the result of the build is a docker image that can be used without worrying about iis configuration.

If not, is there a guidance on how to use the template in local IIS?

I have asked the question on SO Here with no takers or even a try to solve this.

I hope someone of the community who have successfully deployed to local IIS can share his experience here. cheers

yehudamakarov commented 4 years ago

When all this is done I end up with an application that is stuck in login screen entering login information does nothing.

What exactly is this related to? Were you able to find out?

deployed to local IIS can share his experience here

What exactly should i do to try and reproduce?

SuliemanMansouri commented 4 years ago

Hi @yehudamakarov , in order to reproduce my problem, you need to publish the template as it is into a local IIS on windows 10. I just create a new project from the template build it then trying to host it in Windows 10 IIS. First error is: HTTP Error 500.30 - ANCM In-Process Start Failure. When checking event viewer I found 4 erros and one warning. Warning: (.Net Runtime) User b4bb6a81-f067-41f1-b2fb-d886e5173d30 validation failed: DuplicateUserName. I can't find this user in the database. Error 1: (.Net Runtime) Category: Microsoft.AspNetCore.Hosting.Diagnostics EventId: 6

Application startup exception

Exception: System.InvalidOperationException: Key type not specified. at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.LoadKey() at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.Configure(ApiAuthorizationOptions options)

Error 2:(.Net Runtime) Application: w3wp.exe CoreCLR Version: 4.700.19.60701 .NET Core Version: 3.1.1 Description: The process was terminated due to an unhandled exception. Exception Info: System.InvalidOperationException: Key type not specified. at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.LoadKey() at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.Configure(ApiAuthorizationOptions options)

Error 3:(IIS AspNetCore Module V2) Application: w3wp.exe CoreCLR Version: 4.700.19.60701 .NET Core Version: 3.1.1 Description: The process was terminated due to an unhandled exception. Exception Info: System.InvalidOperationException: Key type not specified. at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.LoadKey() at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.Configure(ApiAuthorizationOptions options)

Error 4:(IIS AspNetCore Module V2) Application '/LM/W3SVC/4/ROOT' with physical root 'D:\AppTestIIS\' failed to load coreclr. Exception message: CLR worker thread exited prematurely

After fiddling with appsettings.json and adding a locally generated certificate and adding it to IIS, I can register a new user and I can see his info in the database tables for Identity server. When trying to login using the same credentials nothing happens. At least the unguarded pages work but any controller that needs authorization won't work.

jasontaylordev commented 4 years ago

Hi all. Not specific to IIS but I've added some deployment information here; https://github.com/jasontaylordev/CleanArchitecture/issues/80#issuecomment-605941356.

Hope this helps.

mfandre commented 4 years ago

@SuliemanMansouri how you fix it? I'm with the same problem... I deploy, generate pfx file... Published... but when I try to login I always am redirected to login again...