Reputation: 480
I have to deploy ASP.Net application with remote database connection in IIS server.
Deployment has worked fine without database. And I was able to run that application on the IIS server.
Coming to the application with remote database I have given the connection string in C# code. And it is connected.
My web.config
has thsi connection string :
<configuration>
<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 replaced that with my database connection credentials as follows:
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="Data Source=RemoteHost,1433;Initial Catalog=DBNAME;user Id=MyUserId;Password=MyPassword"
providerName="System.Data.SqlClient" />
</connectionStrings>
In Package/Publish options I have selected (Import from web.config) and deployed that. Then I got the following error:
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.
I am new to ASP.Net. Anybody please help me.
Thank you in advance
Upvotes: 1
Views: 1049
Reputation:
I think you didn't configure Web deployment package correct you can do that right Click on Project ,Select Properties and go to package/Publish SQL I have add link for Walkthrough: Deploying a Web Application Project Using a Web Deployment Package (Part 1 of 4) for VS2010 http://msdn.microsoft.com/en-us/library/dd483479(v=vs.100).aspx
Upvotes: 2