damienbod / IdentityServer4AspNetCoreIdentityTemplate

An ASP.NET Core 6.0 IdentityServer4 Identity Bootstrap 4 template with localization
https://www.nuget.org/packages/IdentityServer4AspNetCoreIdentityTemplate/
MIT License
326 stars 64 forks source link

Switch DB to UseSqlServer #106

Open cjwilding opened 3 years ago

cjwilding commented 3 years ago

I added Microsoft.EntityFrameworkCore.SqlServer to switch to UseSqlServer.

I wanted to see the DB, and I'm more familiar with using a local Sql db vs SQL lite.

It failed with some nonsense.

PM> update-database Build started... Build succeeded. [12:19:29 INF] Entity Framework Core 5.0.7 initialized 'ApplicationDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (53): The network path was not found. at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at Microsoft.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover, SqlAuthenticationMethod authType)

This is the most sophisticated implementation I've seen so far, but it's still not right for me. Much of it is over my head, and there are things in here I don't need. That makes it a difficult starting point.

I wanted to find a repo with Identity Server 4 + Identity + Identity UI. This is the closest one I've found, although it seems like you actually made your own controllers that look like the Identity UI ones.

damienbod commented 3 years ago

Hi @cjwilding This should work fine. You just need to switch the connection string and add the SQL server nuget package. I have added 7 or 8 steps which you needed to implement in the readme. Also this package still uses ID4. You should consider updating this to the latest package with the correct license as required.