Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQLExpress connection trouble in web site

Author  Topic 

Foolong
Starting Member

2 Posts

Posted - 2007-09-12 : 12:05:33
Hi all,

I followed an excellent tutorial (from Microsoft) about creating and using a SQLExpress db table internal to your website and the site I created works just fine - locally. When I publish to my web host provider I get this error:

[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]

My web host provider supports .NET 2.0 but doesn't support MS SQL Server. But that should matter - right? Because I'm putting the db instance right in the website?

I did a search and followed some of the advice:

I went into the SQL Server Surface Area Config Mgr and set SQLExpress for local and remote connections and rebooted/republished. I also have SQL Server 2005 installed as a separate entity (if that makes a difference).

I still get the above error. This is the connection string from the web.config:

<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Customers.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>

And this is the call from the markup:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

SelectCommand="SELECT * FROM [Customer]"></asp:SqlDataSource>

Does any know the fix for this?

Thanking you in advance

Pat

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-12 : 12:10:56
www.connectionstrings.com



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Foolong
Starting Member

2 Posts

Posted - 2007-09-12 : 13:03:35
I think to key finding an answer is this:

My web host provider supports .NET 2.0 but doesn't support MS SQL Server

That's why this project runs on my local box - I have SQLExpress installed and running as part of Visual Studio 2005.

So I think I am wrong in assuming that if I embed the SQLExpress db in the project, the external hosting environment doesn't need to have an instance of SQLExpress running.

Please let me know.

Thanks!



Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-09-12 : 22:09:23
You need to find out which db system your hosting company uses, and modify connection string accordingly.
Go to Top of Page
   

- Advertisement -