If we develop an ASP.NET (MVC) Web site using the ASP.NET Development Server and SQL Server database in use does, at first everything easily.

If, however, for the development of a "real" IIS 7.x, eg Windows 7, we obtain the database access, the following exception:



The solution is pretty simple - you have the Application Pool Identity "IIS AppPool \ mvcapp" assign to the users in the database.

Unfortunately, this does not do this with the SQL Server Management Studio.

Although you can insert the name of the Application Pool Identity



and be validated by "Check Names"



After clicking "OK", but you get the error message that the user was not found:



A solution to generate the login via script:

CREATE LOGIN [IIS AppPool \ MyPool] FROM WINDOWS WITH  DEFAULT_DATABASE = [master] USE [mydatabase] CREATE USER [IIS AppPool \ MyPool] FOR LOGIN [IIS AppPool \ MyPool]  

Then you can assign the SQL Server Management Studio, the permissions so that the website works with the Application Pool Identity.