ASP.NET MVC:连接到数据库的问题 [英] ASP.NET MVC: problem connecting to a database

查看:202
本文介绍了ASP.NET MVC:连接到数据库的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用本指南:
HTTP: //www.asp.net/mvc/tutorials/mvc-music-store-part-7



指示一样,我进入到 ASP.NET Web应用程序管理员,但是当我进入安全标签:




有一个问题与您选择的
数据存储。这可以通过一个
无效的服务器由权限不足名称或凭证,或
引起的。它可以
也未启用角色管理器
功能引起的。点击
下面的按钮被重定向到
页面,您可以选择一个新的数据
店。



下面的消息可能在
帮助诊断问题:无法
连接到SQL Server数据库




<。 p>我没有点击下面的按钮,但它并没有帮助的。



到目前为止,我确实做到了(我想..)像导游说我应该。
我有一种可怕的感觉,答案是显而易见的。



修改1:
BTW,当我打开从导向的完整的解决方案,并尝试打开 ASP.NET Web应用程序管理员,以下错误显示出来:




有与您选择的问题
数据存储。这可以通过一个
无效的服务器由权限不足名称或凭证,或
引起的。它可以
也未启用角色管理器
功能引起的。点击
下面的按钮被重定向到
页面,您可以选择一个新的数据
店。



下面的消息可能帮助
诊断问题:同时建立了
连接到SQL Server时出现
与网络相关的或特定于实例
错误。服务器
未找到或无法访问。
验证实例名称为
正确,以及SQL Server是
配置为允许远程
连接。 (provider:SQL网络
接口,错误:26 - 错误定位
服务器/实例指定)




< STRONG>编辑2:
连接字符串:

 <&是connectionStrings GT; 
<添加名称=MusicStoreEntities
的connectionString =数据源= | DataDirectory目录| MvcMusicStore.sdf
的providerName =System.Data.SqlServerCe.4.0/>
< /&是connectionStrings GT;


解决方案

你有SQL Server Express的安装和你有在app_data文件数据库?


I am using this guide: http://www.asp.net/mvc/tutorials/mvc-music-store-part-7

Like instructed, I entered to ASP.NET Web Application Administrator, but when I enter the security tab:

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: Unable to connect to SQL Server database.

I did clicked the button below, but it didn't help at all.

So far I did exactly (I think..) like the guide said I should. I have a terrible feeling that the answer is obvious.

Edit 1: BTW, When I open the full solution from the guide and try to open the ASP.NET Web Application Administrator, the following error shows up:

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Edit 2: Connection String:

<connectionStrings>
    <add name="MusicStoreEntities"
     connectionString="Data Source=|DataDirectory|MvcMusicStore.sdf"
     providerName="System.Data.SqlServerCe.4.0"/>
  </connectionStrings>

解决方案

Do you have SQL server express installed and do you have the database in app_data?

这篇关于ASP.NET MVC:连接到数据库的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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