My IdentityServer worked fine when selfhosted (Kestrel) but throws an error when hosted in IIS: "An error occurred using the connection to database 'MyTestIDS' on server '.'" and "Login failed for user '(my machine name)$'". I have a connection string defined in appsettings.json with a value "Server=.;Database=MyTestIDS;trusted_connection=True;" and it connects to a SQL Server on my local machine. As I mentioned before, it's been working fine selfhosted until now when I host in IIS. I checked my deployed code and the appsettings.json is there. Does the app still read configuration settings from appsettings.json under IIS? Or should I move it to somewhere else?
I have figured out the issue - the format of the connection string. When slfe-hosting, I used "Server=.;Database=MyTestDB;trusted_connection=True;" and it worked just fine there. But under IIS, I have to change it to something like "Server=MyServer,MyPort;Database=MyTestDB;user id=MyUsrID;Password=MyPassword". Now I am working fine.