4

I've set up a (remote) SQL Server Express for my ASP.NET MVC with Entity Framework 4.3 project. On my local machine using SQL Compact everything works fine. When I try to connect to the SQL Express server I got the following error on the call migrator.Update():

The INSERT permission was denied on the object '__MigrationHistory', database 'MyDataBase', schema 'dbo'.

On the server I've done the following:

  • Created a user with SQL Server credentials
  • Created a database called MyDataBase

Any ideas?

2
  • Did you get your user any permissions on your database? When you create SQL credentials it is actually only login. You than have to create user in the database associated with login and give it permissions for allowed actions on the database. Commented Mar 30, 2012 at 9:10
  • @LadislavMrnka I created a new user and new database and now it works, I think I messed up the permissions in the first database. Thanks. Commented Mar 30, 2012 at 9:45

2 Answers 2

6

The DB roles db_denydatareader,db_denydatawriter must be unchecked for the created user.

Sign up to request clarification or add additional context in comments.

1 Comment

This worked for me as well. Database -> Security -> Users -> Right cick your user -> properties -> Membership --> uncheck "db_denydatareader" and "db_denydatawriter"
1

I was getting this error too. To fix it I added db_owner to my user's "database role membership", and checked the db_owner check box under "schemas owned by this user" (SSMS 2008).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.