开发者

ASP.NET MVC: problem connecting to a database

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 Admini开发者_JS百科strator, 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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜