2013-01-12 147 views
1

我必须在IIS服务器中部署ASP.Net应用程序与远程数据库连接。部署SQL Server Express数据库失败

部署工作正常,没有数据库。我能够在IIS服务器上运行该应用程序。

来到与远程数据库的应用程序我已经给C#代码中的连接字符串。它被连接。

web.config有thsi连接字符串:

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

我更换了我的数据库连接凭证如下:

<configuration> 
    <connectionStrings> 
    <add name="ApplicationServices" 
     connectionString="Data Source=RemoteHost,1433;Initial Catalog=DBNAME;user Id=MyUserId;Password=MyPassword" 
     providerName="System.Data.SqlClient" /> 
    </connectionStrings> 

在封装/发表我选择的选项(进口来自网络。配置)并部署。然后我得到以下错误:

Web deployment task failed.(Object of type 'dbFullSql' and path 'Data "Data Source=RemoteHost,1433;Initial Catalog=DBNAME;user Id=MyUserId;Password=MyPassword" cannot be created.)

Object of type 'dbFullSql' and path "Data Source=RemoteHost,1433;Initial Catalog=DBNAME;user Id=MyUserId;Password=MyPassword" cannot be created.

The source is invalid.
Script failed for Database 'DBNAME'.
Script failed for Database 'DBNAME'.
Index was outside the bounds of the array.

我是ASP.Net的新手。任何人都请帮助我。

预先感谢您

+0

你在IIS中看到你的连接字符串在VS中是否一样? – 2013-01-12 12:35:03

+0

我想在我自己的PC中部署到IIs。这两个服务器的数据库是相同的。在SQL的Package/Publish选项中,我没有指定任何目标连接字符串。首先,我试图构建部署包,但失败了。 – Swapnika

+0

好的我张贴演练链接寻求帮助 – 2013-01-12 12:55:47

回答

2

我想你没有配置Web部署包纠正你可以做到这一点鼠标右键单击项目,选择属性,进入包/发布SQL 我有添加链接演练:部署一个使用Web部署包的Web应用程序项目(第1部分,共4部分)适用于VS2010 http://msdn.microsoft.com/en-us/library/dd483479(v=vs.100).aspx

+0

谢谢你的回复。我的系统中没有SQL。我正在连接到远程sql服务器。是否有可能在我的系统中作为目标数据库在该系统中创建一个DataBase ..? R有可能为源和目标使用相同的数据库..? – Swapnika

+0

是的。你可以但真的因为我不使用远程SQL服务器。我不知道如何。只是阅读演练,它会给你答案 – 2013-01-12 13:27:51

+0

K.非常感谢。 – Swapnika

相关问题