奇怪的 SQL Server 连接数据库错误

发布于 2024-08-31 16:20:02 字数 632 浏览 3 评论 0原文

我正在使用 SQL Server 2008 Enterprise 和 VSTS 2008,并且正在使用 ASP.Net 和表单身份验证开发一个简单的 Web 应用程序。

当我使用我的ASP.Net项目的VSTS的配置工具/菜单时(我想使用这个工具手动添加一些Forms身份验证用户),我遇到了以下错误(SqlException),

Trying to attach file D:\Projects\MyTest\App_Data\aspnetdb.mdf to automatically named database failed. It may be caused by existing the same name database, or may be caused by specified file can not be opened or caused by the specified file exists in UNC share.

在我的计算机中,没有dir D:\Projects\MyTest\App_Data 下的 aspnetdb.mdf,为什么会搜索这个目录?在运行配置工具之前,我已经使用aspnet_regsql成功生成了数据库。为什么会出现这样的错误呢?如何修复它?

提前致谢, 乔治

I am using SQL Server 2008 Enterprise with VSTS 2008, and I am developing a simple web application using ASP.Net and Forms Authentication.

When I am using the configuration tool/menu of VSTS of my ASP.Net project (I want to use this tool to manually add some Forms authentication users), I met with the following error (SqlException),

Trying to attach file D:\Projects\MyTest\App_Data\aspnetdb.mdf to automatically named database failed. It may be caused by existing the same name database, or may be caused by specified file can not be opened or caused by the specified file exists in UNC share.

In my computer, there is no aspnetdb.mdf under dir D:\Projects\MyTest\App_Data, and why this dir will be searched? And I have used aspnet_regsql to generate database successfully before I run the configuration tool. Why there is such error? How to fix it?

thanks in advance,
George

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

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

发布评论

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

评论(1

雨落□心尘 2024-09-07 16:20:02

您是否已使用命名连接设置您的提供商?

<connectionStrings>
  <add name="NamedConnectionString" 
   connectionString="xxxxxxxx" />
</connectionStrings>

 <membership defaultProvider="MembershipADProvider">
  <providers>
    <add
  name="MembershipADProvider"
  type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, 
        Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            connectionStringName="NamedConnectionString" />
   </providers>
 </membership>

您说您使用了 aspnet_regsql,这表明您正在尝试使用 ASP.NET 成员资格提供程序。如果您没有在配置中配置提供程序和连接,那么它将在您站点的 App_Data 目录中查找名为 aspnetdb.mdf 的 SQL Server Express 文件。

Have you set up your provider with a named connection?

<connectionStrings>
  <add name="NamedConnectionString" 
   connectionString="xxxxxxxx" />
</connectionStrings>

 <membership defaultProvider="MembershipADProvider">
  <providers>
    <add
  name="MembershipADProvider"
  type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, 
        Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            connectionStringName="NamedConnectionString" />
   </providers>
 </membership>

You said that you used aspnet_regsql, which suggests that you are attempting to use the ASP.NET Membership Providers. If you don't configure the providers and connections in your config, then it will look for a SQL Server Express file called aspnetdb.mdf in the App_Data directory of your site.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文