SQL and IIS error when publish an ASP .NET application to IIS

0

I have added a database to my application and then published it in IIS. I am getting an SQL error and IIS error when trying to browse to the site and have been trying to figure it out all day. I hope you can look and see if you can come up with something. The IIS error is: "Cannot open database "KML" requested by the login. The login failed. Login failed for user 'NT AUTHORITY\SYSTEM'". The SQL error is: "[SqlException (0x80131904): Cannot open database 'KML' requested by the login. The login failed. Login failed for user 'NT_AUTHORITY\SYSTEM'. ] . I hope someone can figure out what the problem is. Thanks.

sql
iis
asked on Stack Overflow Jan 30, 2020 by holdorfs

1 Answer

0

When you publish a website to iis it typically runs under the identity of the application pool and for new sites a new pool is created, named after the site and having a windows user of IIS AppPool\site-name-here. To have a connection to the db work out with Windows mode authentication you need to make a user/login in the database with a name that matches the application pool

In your case you're running your site on an app pool that seems to use ntauthority\system (local system) as it's identity. This is a monumentally bad idea; anyone who finds a way to exploit it will gain admin privileges to the entire machine. Notwithstanding throw, you'll still need to make a login and map the user to it for the KML database in order for that user to be able to log into the db using Windows auth

answered on Stack Overflow Jan 31, 2020 by Caius Jard

User contributions licensed under CC BY-SA 3.0