开发者

Asp.net MVC Hosting - SQL Server

So I'm moving my Asp.net mvc web app over to Arvixe shared hosting. This is the first time I've deployed an MVC app. I have been using SQL Server 2008 Express for the development database. Arvixe provides SQL Server 2008 or MySQL hosted databases.

A couple questions:

1.Can I use the mdf files from my Express database with the new Non-Express prodcution DB?

2.I'm having issues with my connection string. I changed the original web config connection string from this:

<add name="Database1ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=开发者_如何学JAVATrue"
   providerName="System.Data.SqlClient" />

to this:

<add name="Database1ConnectionString" connectionString="Data Source=.;Integrated Security=SSPI;Initial Catalog=ProdsDB"
   providerName="System.Data.SqlClient" />

Now I'm getting this error: Cannot open database "ProdsDB" requested by the login. The login failed

I have setup the database called "ProdsDB" through the Arvixe control panel and added one user. Do I need to add the credentials somewhere in the connection string?


Yes. You're going to need to add User Id=myUsername;Password=myPassword; to the connection string, and you'll need to remove Integrated Security=SSPI

Of course, you'll need to set them to the username and password you created. Also, sometimes hosting providers host the database on a separate server. If that's the case, you'll have to specify the servername in place of the dot.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜