实体框架7代码第一个错误CREATE DATABASE权限被拒绝在数据库'master'中

时间:2022-09-06 21:09:00

I'm using vs2015 an vNext/Asp.net5 wint EF7. my config.json file has following value

我正在使用vs2015 vNext / Asp.net5 wint EF7。我的config.json文件具有以下值

"TestContextConnection": "Server=.\\SQLEXPRESS;Database=TestDb;Trusted_Connection=true;MultipleActiveResultSets=true"

Whenever I run this project I get the following error

每当我运行这个项目时,我都会收到以下错误

CREATE DATABASE permission denied in database 'master'.

Can someone please explain, I don't know what user I'm referring here is it my active directory user or some other dbuser? also what rights I've to assign to what user in order this code to work successfully? what if I have to create a new user from scratch with all required permissions for this?

有人可以解释一下,我不知道我在这里指的用户是我的活动目录用户还是其他一些dbuser?还有什么权利我分配给哪些用户才能使这段代码成功运作?如果我必须从头创建一个具有所有必需权限的新用户怎么办?

Thanks in advance.

提前致谢。

2 个解决方案

#1


1  

Do you need to use the TestDb database on the SQLEXPRESS server, or are you just trying to get something up and running?

您是否需要在SQLEXPRESS服务器上使用TestDb数据库,或者您只是想尝试启动并运行?

If you are just trying to get something up and running, try using the following for your connection string: Server=(localdb)\\MSSQLLocalDB;Database=<DATABASE_NAME>;Trusted_Connection=True;MultipleActiveResultSets=true

如果您只是尝试启动并运行,请尝试使用以下连接字符串:Server =(localdb)\\ MSSQLLocalDB; Database = ; Trusted_Connection = True; MultipleActiveResultSets = true

#2


0  

I figured out I was point to the wrong sql server instance on my machine. I corrected the server instance and my problem was resolved.

我发现我的机器上指的是错误的sql server实例。我更正了服务器实例,问题解决了。

#1


1  

Do you need to use the TestDb database on the SQLEXPRESS server, or are you just trying to get something up and running?

您是否需要在SQLEXPRESS服务器上使用TestDb数据库,或者您只是想尝试启动并运行?

If you are just trying to get something up and running, try using the following for your connection string: Server=(localdb)\\MSSQLLocalDB;Database=<DATABASE_NAME>;Trusted_Connection=True;MultipleActiveResultSets=true

如果您只是尝试启动并运行,请尝试使用以下连接字符串:Server =(localdb)\\ MSSQLLocalDB; Database = ; Trusted_Connection = True; MultipleActiveResultSets = true

#2


0  

I figured out I was point to the wrong sql server instance on my machine. I corrected the server instance and my problem was resolved.

我发现我的机器上指的是错误的sql server实例。我更正了服务器实例,问题解决了。