The EXECUTE permission was denied on the object 'aspnet_CheckSchemaVersion', database 'XXX'

GibboK picture GibboK · Oct 10, 2011 · Viewed 44k times · Source

I use asp.net 4 C# and entity framework 4 with MS SQL 2008. I'm trying to set up my web application locally using IIS 7.

For my website I user Asp membership provider which has installed different tables and sprocs in my db (aspnet_).

Running the script we receive this error:

The EXECUTE permission was denied on the object 'aspnet_CheckSchemaVersion', database 'XXX', schema 'dbo'. at System.Data.SqlClient.SqlConnection.OnError

How can I solve the problem?

Answer

Simon Halsey picture Simon Halsey · Oct 10, 2011

There should be some db roles related to the membership tables, eg aspnet_profile_fullaccess. Make sure the account you're using is a member of the appropriate role.

You should NOT assign the user you connect to the DB as dbowner privilege. The account should have only the rights it needs & nothing more. If you grant dbo & someone were to exploit a flaw in your website they would have full uncontrolled access to your entire db to what they wanted - delete tables, change data at will.