vinu
vinu

Reputation: 71

cannot access sql server after publishing site in iis7

I am created a website using visual studio 2010. On the time of the development of website I am able to access the database.. but after publishing the site using IIS7..i was unable to access the database..the exception occured during that time was "the connection is in the closed state".in IIS7 When I changed the application pool identity to localsystem, it worked. Data base is installed in the same machine. and server is SQL SERVER 2008 R2

Upvotes: 0

Views: 1169

Answers (2)

user1925921
user1925921

Reputation: 120

you can only access database with sql authentication after publishing it.

Upvotes: 1

Niels Brinch
Niels Brinch

Reputation: 3632

In IIS7 the application pool by default runs under the IIS AppPool\[Application Pool Name]

That means, if your app pool is called "MyWebSite", then you must give the following user permissions to use your database: IIS AppPool\MyWebSite

It won't be in any list, so you'll have to type it as above when adding it.

I suggest making it database owner if you're in doubt about which permissions to give it. If it works, you can always refine the permissions later

Upvotes: 0

Related Questions