5
Reply

Lost connection to database when site was published. (Using Linq and ASP.Net)

Salam

Salam

Nov 28 2009 1:10 PM
5.1k

Hi everyone,

I was able to connect to the database on my desktop. But where I publish the website (host: 1and1.com), I fail to connect to the database.

I use Linq to SQL. Which creates these connection lines in Web.config:

<add name="dbSiteEntities" connectionString="metadata=res://*/common.dbSMModel.csdl|res://*/common.dbSMModel.ssdl|res://*/common.dbSMModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;Initial Catalog=dbSite;Persist Security Info=True;User ID=sa;MultipleActiveResultSets=True""providerName="System.Data.EntityClient" />

<add name="dbSiteConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=db33333333;Persist Security Info=True;User ID=sa;Password=*******"providerName="System.Data.SqlClient" />

These worked perfectly fine in my desktop. But when I published the website, I was given this connection string:

Provider=sqloledb;Data Source=***.***.perfora.net,1433;Initial Catalog=db33333333;User Id=dbo33333333;Password=*****;

So, I changed the Web.config files to this:

<add name="dbSiteEntities" connectionString="metadata=res://*/common.dbSMModel.csdl|res://*/common.dbSMModel.ssdl|res://*/common.dbSMModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=***.***.perfora.net,1433;Initial Catalog=db33333333;Persist Security Info=True;User ID=dbo33333333;MultipleActiveResultSets=True""providerName="System.Data.EntityClient" />

<add name="dbSiteConnectionString" connectionString="Data Source=***.***.perfora.net,1433;Initial Catalog=db33333333;Persist Security Info=True;User ID=dbo33333333;Password=*****" providerName="System.Data.SqlClient" />

It's not working! Please help!

Thanks!


Answers (5)