Last week I faced one problem. I created one website using MVC3and Entity Framework. When I hosted the website I start getting the below error.
CREATE DATABASE permission denied in database ‘master’
I checked the connection string in web.config file. It looks fine. I checked the connection string key its similar to my Context calss. Then where the problem is? Why Entity Framework is trying to create a table in Master database.
I suggest that if you face this issue, check the following things.
- Check your connection string in web.config file. Is the database name, User Id and password is correct.
- Second point is your context class name should be equal to your connection string name.
- In global.asax file, in application start method write down the following line,
I solve this issue by making the context class to null. You need to include the reference of System.Data.Entity in your Global.asax class.