asp.net mvc 3 成员身份,无法连接到数据库

发布于 2024-12-12 03:55:39 字数 734 浏览 0 评论 0原文

我已经安装了 Visual Studio 2010 和 MVC 3,并且一直在一个网站上工作。 后来我安装了sql server 2008,当我尝试通过asp.net mvc中提供的成员资格注册用户时,我遇到了一堆错误,说没有数据库或类似的东西,所以通过大量研究,我终于添加了aspnetdb到我的 sql 服务器并启用远程访问...并且现在当我尝试注册时出现此错误:无法连接到 SQL Server 数据库。

建立与 SQL Server 的连接时发生与网络相关或特定于实例的错误。找不到服务器或无法访问服务器。验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接。 (提供程序:SQL 网络接口,错误:26 - 指定服务器/实例错误)

这是我的连接字符串:

<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated     Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"  providerName="System.Data.SqlClient" />
</connectionStrings>

我记得前一段时间在处理我之前的项目时,我对会员提供程序和注册用户登录没有任何问题,所以上..所以我真的很沮丧,不知道我在这里错过了什么。

I have installed visual studio 2010 as well as mvc 3 and have been working on a site.
Later I installed sql server 2008 and when I tried to register a user through provided membership in asp.net mvc i had bunch of errors saying that there was no data base or something like that, so through a lot of research i finally added the aspnetdb to my sql server and enabled remote accessing... and as of right now when i try to register i get this error: Unable to connect to SQL Server database.

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)

this is my connection string:

<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated     Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"  providerName="System.Data.SqlClient" />
</connectionStrings>

I remember that some time ago working on my previous projects i had no problem with the membership provider and registering users loging in and so on.. so i'm really frustrated and don't know what i'm missing here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

十级心震 2024-12-19 03:55:40

您可以直接从本地主机使用它,无需将其放在 App_Data 文件夹中。使用此连接字符串:

  <connectionStrings>    
        <add name="ApplicationServices" connectionString="Data Source=.\SQLEXPRESS; Initial Catalog=*Name of your database*;Integrated Security=SSPI"/>
  </connectionStrings>

You can use it directly from localhost, no need to put it in App_Data folder. Use this connection string:

  <connectionStrings>    
        <add name="ApplicationServices" connectionString="Data Source=.\SQLEXPRESS; Initial Catalog=*Name of your database*;Integrated Security=SSPI"/>
  </connectionStrings>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文