数据库连接错误 [英] Error in database connectivity

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

问题描述

我正在尝试连接数据库.具有相同名称的数据库仅存在一次.但是在每次尝试连续性时都会发生以下错误.请指导我哪里有错误..以及如何将其删除...
在此先感谢


I am trying to connect database. database with the same name exists only once. but on every attempt of conncetivity following error occurs. please guide me where is error.. and how i remove it...
thanks in advance


An attempt to attach an auto-named database for file C:\User\Adminitrator\My Document\WebSites\project\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

推荐答案

当我们在SQL Server的Express版本中使用自动附加功能时,就会出现问题.这是由于默认情况下ASP.NET使用默认的ASPNET帐户,并且SQL Server不允许它访问数据库文件.验证连接字符串并设置正确的模拟可能会有所帮助.

在这里,讨论了以下错误以及如何解决该错误:
问题排查错误:尝试为文件附加自动命名的数据库... [尝试为文件-2附加自动命名数据库 [ [
The problem manly occurs when we use the auto attach feature in Express editions of SQL Server. It is due to the fact that by default ASP.NET uses the default ASPNET account and the SQL Server does not allow it to access the database file. Verifying your connection string and setting proper impersonation might help.

Here, following error discussed and how to troubleshoot it:
Troubleshoot Error: An attempt to attach an auto-named database for file...[^]
An attempt to attach an auto-named database for file - 2[^]

OR
it may be just incorrect reference to MDF file: An attempt to attach an auto-named...[^]



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

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