实体框架4.1代码首先在数据库'master'中拒绝CREATE DATABASE权限 [英] entity framework 4.1 code first CREATE DATABASE permission denied in database 'master'
问题描述
我收到这个错误
数据库'master'中的CREATE DATABASE权限被拒绝。 >
但我添加了 app.config
文件并设置相关的连接字符串对我的SQL Server 2005数据库(我已经使用 DbContext
作为我的上下文)
请帮助我。 p>
这是我的连接字符串:
< configuration>
< connectionStrings>
< add name =TasksEntities
connectionString =server =(local); database = Tasks; trusted_connection = false; User = sa; Password = ****; Persist Security Info = True
providerName =System.Data.SqlClient/>
< / connectionStrings>
< / configuration>
我刚刚遇到这个问题。连接字符串名称必须与DbContext子类的类名完全匹配。如果没有EF不会找到连接字符串,并且会尝试回退做其他(SQL嵌入式),这在我的机器上不起作用(我已经安装了完整的SQL Server)。
I have created a generic repository project using Entity Framework 4.1 and it works great with my projects when added as an existing project to them but it doesn't work on them when just referenced as dll.
I get this error
CREATE DATABASE permission denied in database 'master'.
but I have added app.config
file and set relevant connection string to my SQL Server 2005 database (I have used DbContext
as type my context)
Please help me.
Here is my connection string :
<configuration>
<connectionStrings>
<add name="TasksEntities"
connectionString="server=(local); database=Tasks; trusted_connection=false; User=sa; Password=****; Persist Security Info=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
I just ran into this myself. The connection string name must match the class name of your DbContext subclass exactly. If it doesn't EF will not find the connection string and will try and fall back to doing something else (SQL embedded?) which doesn't work on my machine (I have full SQL Server installed).
这篇关于实体框架4.1代码首先在数据库'master'中拒绝CREATE DATABASE权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!