MVC获取错误 - CREATE DATABASE权限被拒绝 [英] MVC Getting Error - CREATE DATABASE permission denied

查看:131
本文介绍了MVC获取错误 - CREATE DATABASE权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次使用MVC,运行应用程序时我收到这个错误。



这里是我的步骤


  1. 创建一个新的 MVC 空项目

  2. 安装实体框架5.0.0(PM> Install-Package EntityFramework -Version 5.0.0)

  3. 在Model-MovieReview.cs和MovieReviewContext.cs中添加两个类。

MovieReview类是这个





而MovieReviewContext Class就是这个


  1. 在Controllers文件夹中,我添加一个名为HomeController的新Controller。这是它。

然后我在Google Chrome或IE上运行。我收到了我在上面提到的错误。
不明白该怎么办感谢任何帮助



EDIT
我没有更改任何文件中的任何自动生成的代码。

解决方案

尝试在web.config中添加一个连接字符串,例如。

 < connectionStrings> 
< add name =MovieReviewContext
connectionString =Data Source =; Integrated Security = true; Initial Catalog = MovieReviewContext;
providerName =System.Data.SqlClient/>
< / connectionStrings>


I am using MVC first time, and I got this error when running the application.

Here are my steps.

  1. Create a new MVC empty Project
  2. Install Entity framework 5.0.0 ( PM> Install-Package EntityFramework -Version 5.0.0 )
  3. Add two classes in Model- MovieReview.cs and MovieReviewContext.cs .

MovieReview Class is this

And MovieReviewContext Class is this

  1. In Controllers folder I add a new Controller, named HomeController. Here is it .

Then I run it on Google Chrome or on IE. And I got the error I mentioned on the top. Can't understand what to do. Thanks for any help

EDIT I did not change any auto-generated code in any file.

解决方案

Try to add a connection string in the web.config, something like.

  <connectionStrings>
    <add name="MovieReviewContext" 
         connectionString="Data Source=.; Integrated Security= true; Initial Catalog=MovieReviewContext;" 
         providerName="System.Data.SqlClient" />
  </connectionStrings>

这篇关于MVC获取错误 - CREATE DATABASE权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆