Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.

Search This Blog

Wednesday 27 July 2011

ASP.NET MVC with SQL SERVER giving error "The SELECT permission was denied on the object 'account', database 'accounting', schema 'dbo'"

Developed an ASP.NET mvc application and ready to publish. Now steps anyone would have generally followed :-

1. Create an new application pool "AccountingAppPool" with ".NET Framework version" as v4.0.30319
2. Assign "Identity" as "NetworkService"
3. Publish the web application to http://localhost/Accounting/
4. Assign application pool as "AccountingAppPool"
5. Now check web.config

for connection string
   
    

.....


.....

6. using SQL server management studio connect to database. Add "NT AUTHORITY\NETWORK SERVICE" to logins to allow access for the identity of application pool

7. All done just run the application


Now a very disappointing error
"The SELECT permission was denied on the object 'account', database 'accounting', schema 'dbo'"

User is able to connect to database but does not have access. Ok now this is frustrating. Having spent hours thinking why this is not working.

Finally after a lot of help, found the issue is actually because of impersonation.

Now modified web.config to :-


Hurray! it worked.

To have no errors
Would be life without meaning
No struggle, no joy
~Brian M. Porter, 1998
Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers