Wednesday, March 28, 2012

Question regarding SQL Express and Connection Strings

Hello everyone!

I am having some more problems while trying to get my site online. I built the site offline using Visual Web Developer Express Edition, and used "SQL Server Express" that comes with ASP.Net. Therefore, I have the ASPNETDB.mdf and mydatabase.mdf in the App_Data folder. Now, on my local machine everything runs fine. When I tried to put the site online however, I get the following error:

An error has occurred while establishing a connection tothe server. When connecting to SQL Server 2005, this failure may becaused by the fact that under the default settings SQL Server does notallow remote connections. (provider: SQL Network Interfaces, error: 26- Error Locating Server/Instance Specified)

This is the connection string in my web.config file:

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

Now, my web-host does have SQL Server 2005. Does my ASP.Net application use that though, since I have it running just through SQL EXPRESS? Also, does anyone know where I could change my "SQL Server 2005" settings? My web-host uses Plesk 8.2.0, and the database managing program is "ASP.Net Enterprise Manager", but I can't find any options anywhere to change the Server settings to allow remote connections.

Any help would be greatly appreciated! Thanks in advance,

Markuu

You will need to upsize from the sql 2005 express to sql 2005 databases or database.

A good guide to the steps needed is at

http://weblogs.asp.net/scottgu/archive/2006/12/22/recipe-deploying-a-sql-database-to-a-remote-hosting-environment-part-1.aspx

Hope it helps

|||

I don't believe Remote Connections is the issue. The error message clearly states that it could not find the instance of Sql Server that is specified in Data Source part of your connection string - (local)\SQLEXPRESS. That part is the address and name of the Sql Server you are trying to attach to. It's highly improbable that the instance you are using in a hosted environment is called SQLEXPRESS (which is the default name given to instances of Sql Server Express).

I'm not familiar with Plesk or your management system, but usually Web hosting companies will give you an instance that uses something like your user name, or account name. They should also provide a sample connection string and some guidance in a FAQ somewhere. If you can't find it, contact their support.

General connection string related stuff can be found here: www.connectionstrings.com

No comments:

Post a Comment