Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login failed for user 'IIS APPPOOL\myAppPoolName' and cannot add new user for this

I am getting the following error while asp.net app trying to connect database. Login failed for user 'IIS APPPOOL\myAppPoolName'.

I use ms SqlServer 2008 r2, windows server 2008 r2.

This happened when I've just moved the application and database from one server to another.

I thought adding a new user to database named 'IIS APPPOOL\myAppPoolName' but when i try it, I'm getting following error on adding new db user wizard:

'IIS APPPOOL\myAppPoolName' is not a valid name because it contains invalid characters. (Microsoft SQL Server, Error: 15006)

How can I fix this?

Thanks in advance.

Erdem.

like image 497
Erdem Şekerci Avatar asked Feb 10 '23 00:02

Erdem Şekerci


2 Answers

By default, custom application pools receive the 'Network Service' user credentials. Simply try adding a new login for your mssql server (and database, of course) for the 'Network Service' account. Read more here

like image 86
Nissim Avatar answered Feb 11 '23 14:02

Nissim


Thanks @Nissim

In Sql > Security > Logins > Right-click > new login > Login name "NT AUTHORITY\NETWORK SERVICE"

In Same New login window On left side > User Mapping > Check the database you want > Select each database and in Database roles (second box below) > db_owner

Click Ok

In IIS > Application Pools > Your app pool > advance settings > Identity (change to "NetworkService")

Click Ok

like image 28
Zain Ullah Muhammad Avatar answered Feb 11 '23 13:02

Zain Ullah Muhammad