Monday, June 21, 2010

Classic ASP Login failed for user 'NT AUTHORITY\IUSR'

Most often I build asp .net applications and connect to a local development database using windows authentication. I tried to do the same thing (connect using windows authentication) with a classic asp application I'm working on converting to .net, and got this error:
Login failed for user 'NT AUTHORITY\IUSR'

To remedy the issue I did the following:
1. Open Microsoft SQL Server Management Studio
2. On Registered Servers expand nodes to find database server
3. Right-click on database server > Object Explorer
4. Expand 'Security' node
5. Right-click on 'Logins' > 'New Logins...'
6. Login name: 'NT AUTHORITY\IUSR'
7. Click 'OK'
8. Expand 'Databases' node > 'Your_DB_Name' node > Security
9. Right-click 'Users' > 'New user..."
10. User name: 'Whatever_you_want'
11. Login name: NT AUTHORITY\IUSR
12. In the 'Database role membership', check 'db_datareader' and 'db_datawriter'
13. Click 'OK'

That was it - the classic application was able to connect.

I could have created a new user and connected using SQL Server Authentication mode (I actually tried this first, but then realized the server security settings were set to 'Windows Authentication mode' not 'SQL Server and Windows Authentication mode'), but this allowed me to keep my current server security setting of 'Windows Authentication mode' and keep my connection strings consistent between my classic asp and asp .net applications.

1 comment:

  1. Thanks....simple instructions helping me to convert over some database files

    ReplyDelete