无法连接到远程 SQL Server 2005
我已经使用数据库 ASPNETDB.MDF 创建了我的 asp.net 网站,但是当我尝试在服务器上托管我的网站时...
SQL Server 2005 托管提供商向我发出问题,
database name dobriyalji
server ip : 69.112.222.220
database username : XXXX
database password : XXXX
我已将所有 ASPNETDB.MDF 表导入到我的服务器数据库 dobriyalji ...
并且我从 App_Data 文件夹中清空 Appdata.mdf 和 aspnetdb.log 文件...
当我尝试运行我的网站时,会发生以下错误...
尝试为文件附加自动命名数据库 用户\Ashish Dobriyal\Documents\Visual Studio 2008\网站\沃尔沃\App_Data\ASPNETDB.MDF
失败。存在同名数据库,或指定文件不存在 已打开,或者位于 UNC 共享上。
我的本地主机连接字符串:
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
我的远程主机连接字符串:
<connectionStrings>
<add name="vbi_india2kConnectionString" connectionString="Data Source=69.112.222.220;Initial Catalog=dobriyalji;Persist Security Info=True;User ID=XXXX;Password=XXXX" providerName="System.Data.SqlClient"/>
</connectionStrings>
I have created my asp.net website using database ASPNETDB.MDF but when I try to host my site on server ...
The SQL Server 2005 hosting provider issue me the
database name dobriyalji
server ip : 69.112.222.220
database username : XXXX
database password : XXXX
I have imported all of my ASPNETDB.MDF tables to my server database dobriyalji ...
And I empty the Appdata.mdf and aspnetdb.log file from App_Data Folder ...
When I try to run my site the following error occurs ...
An attempt to attach an auto-named database for file
Users\Ashish Dobriyal\Documents\Visual Studio
2008\WebSites\VOLVO\App_Data\ASPNETDB.MDFfailed. A database with the same name exists, or specified file cannot
be opened, or it is located on UNC share.
MY LOCALHOST CONNECTION STRING :
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
MY REMOTE HOST CONNECTION STRING :
<connectionStrings>
<add name="vbi_india2kConnectionString" connectionString="Data Source=69.112.222.220;Initial Catalog=dobriyalji;Persist Security Info=True;User ID=XXXX;Password=XXXX" providerName="System.Data.SqlClient"/>
</connectionStrings>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须使用 发布数据库向导以部署本地数据库到您的生产数据库服务器。
You have to use publish database wizard to deploy local database to your production database server.
您是否有开发计算机上的物理 mdf / ldf 文件。假设您这样做,错误“无法打开指定的文件”是非常清楚的。您是否使用与其他站点共享的 SQL Server?如果是的话,sql server 上是否有一个名为 aspnetdb 的数据库?在附加数据库时,您可能必须更改数据库的名称才能将其加载到 SQL Server 上。
Do you have the physical mdf / ldf files from your development machine. Assuming you do as the error "specified file cannot be opened" is quite clear. So are you on a shared SQL Server with other sites; if so is there a database on the sql server called aspnetdb? You may have to change the name of your database as you attach it in order to get it onto the sql server.