MVC 4的connectionString到SQL Server 2012中 [英] MVC 4 Connectionstring to SQL Server 2012

查看:133
本文介绍了MVC 4的connectionString到SQL Server 2012中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建新的MVC 4品牌使用Visual Studio 2012年。我试图连接到一个全新的SQL Server 2012(标准)实例,但我似乎无法让我的连接字符串中正确设置应用程序在C#

I've created a brand new MVC 4 application in C# using Visual Studio 2012. I'm trying to connect to a brand new SQL Server 2012 (Standard) instance but I can't seem to get my connection string set correctly.

这是我的web.config我的连接字符串:

My connection string from my Web.config:

  <connectionStrings>
    <add name="ConnectionStringName"
        providerName="System.Data.SqlClient"
        connectionString="Data Source=MyServerName;
                          Initial Catalog=MyDatabaseName;
                          Integrated Security=False;
                          User ID=MyUserID;Password=MyPassword;
                          MultipleActiveResultSets=True" />
  </connectionStrings>

我每次去ASP.NET配置从Visual Studio,在页面加载中,但只要我点击安全,我得到了以下信息:

Every time I go to ASP.NET Configuration from within Visual Studio, the page loads, but as soon as I click "Security" I get the following message:

有与您选择的数据存储问题。这可以导致
  无效服务器名或凭证,或不足
  允许。它也可以由该角色管理器功能引起了不
  被启用。点击下面的按钮被重定向到一个网页,
  你可以选择一个新的数据存储。

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.

下面的消息可能会有助于诊断问题:无法
  连接到SQL Server数据库。

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

我已经验证了我的凭据是正确的(我可以使用它们通过SQL管理Studio连接)。还有什么我可以检查?我难倒。

I've verified that my credentials are correct (I can use them to connect via SQL Management Studio). Is there anything else I can check? I'm stumped.

更新:

我是不是能够从SQL Management Studio中(MSSQLSERVER)内连接到我的默认实例,所以我重新安装了SQL,创建一个命名实例(LHSQLSERVER)。现在,我能够连接到在SQL Management Studio中的实例,但我还是从ASP.NET配置得到同样的错误。

I wasn't able to connect to my default instance from within SQL Management Studio (MSSQLSERVER) so I reinstalled SQL, creating a named instance (LHSQLSERVER). Now I'm able to connect to that instance in SQL Management Studio, but I'm still getting the same error from the ASP.NET Configuration.

另外要注意的 - 在aspnet_regsql工具,我跑是从Framework64 \\ v4.0.30319文件夹中。那是正确的,如果我使用.NET 4.5?

Another thing to note - the aspnet_regsql tool I ran was from the Framework64\v4.0.30319 folder. Is that correct if I am using .NET 4.5?

更新2:

我试着连接字符串替换我的连接字符串到远程站点(即mysite.winhost.com),我知道的作品,但我仍然得到同样的错误在ASP.NET网站配置工具? FWIW我还使用Windows 8的,但我并不认为这无关紧要。

I've tried replacing my connection string with a connection string to a remote site (i.e. mysite.winhost.com) that I know works, but I'm still getting the same error in the ASP.NET Website Configuration Tool? FWIW I'm also using Windows 8, but I didn't think that would matter.

任何其他人的事情,我可以检查?

Any thing else I can check?

更新3:

我发现这个帖子说你不需要aspnet_regsql工具对了MVC 4,所以我重新运行该工具删除所有的设置,但同样,没有运气。有没有人用MVC 4这样做呢?

I found this post that says you don't need the aspnet_regsql tool anymore for MVC 4, so I re-ran the tool removing all the settings, but again, no luck. Has anyone done this with MVC 4 before?

更新4:

请参阅下面的我找到了解决方案,我的答案。

See my answer below for the solution I found.

推荐答案

感谢大家的投入,我终于找到了解决办法。我碰到的 这篇文章 描述了VS 2012用来MVC 4.我基本上只是开始了,创建一个新的数据库,新的MVC 4项目,只是跟着文章中说明新成员简单。果然,就在网页上的注册在我的数据库中创建的表(S)和存储的用户信息。

Thanks everyone for the input, I have finally found a solution. I came across this article that describes the new Simple Membership that VS 2012 uses for MVC 4. I basically just started over, creating a new database, new MVC 4 project, and just followed the instructions in the article. Sure enough, just "registering" on the web page created the table(s) in my database and stored the user information.

这篇关于MVC 4的connectionString到SQL Server 2012中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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