View Full Version : Database error when hosted, not when run locally.
CameronD
11-13-2006, 02:51 AM
Beginning with the Personal website starter kit, I combined the two databases into one personal.mdf file. I then attached the mdf file to my hosted SQL DB, and updated my Web.config file accordingly. The site now runs fine on my local machine, even though it is using the hosted DB, but it does not work properly when the rest of the site is moved onto the hosted server. This seems very strange, and I am at a loss for what I have done wrong.
Specifically, I can get to the main page online, just fine, but when I try to log in to the siteI receive the following error:
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)
Any ideas? Thanks in advance.
Cameron
kkarasin
11-13-2006, 07:04 AM
I've ran into this error on other projects when I'm running a SQL 2000 DB the solution that's worked for me has to, in the web config cleared all my connection strings and then
<connectionStrings>
<clear/>
remove this from the connection string providerName='System.Data.SqlClient'
I have all so had to remove the integrated security attribute in the connection string..
If your running the built in membership provider also make sure that your applicationName name is set correctly
<add name='AspNetSqlRoleProvider' connectionStringName='MyAspNetDB'
applicationName='/SampleRolesApp'
kevinasp.com (http://kevinasp.com)
CameronD
11-16-2006, 03:06 AM
Thanks for the advice, however I still can't get it to work and I am wondering if perhaps I didn't completely understand your instructions. Listed below is the original connection string that connects to the hosted DB, and works fine when run locally, but not when the web.config file is moved onto the hosted server.
<add name="SQLConnectionString"
connectionString="Data Source=tcp:*******;Initial Catalog=*******;User ID=******;Password=*****;"
providerName="System.Data.SqlClient" />
</connectionStrings>
kkarasin
11-16-2006, 04:59 AM
try getting ride of this part of the connection string
providerName='System.Data.SqlClient
if your running sql2000 if your using membership provider then make sure that you add the application name attribute
also try to use the <clear/> node above your connection string
make sure that if you using the membership role provider the its provider is SQLConnectionString
your web.config should look kinda like this
<configuration>
<connectionStrings>
<add name='SQLConnectionString' connectionString='...' />
</connectionStrings>
<system.web>
... authentication & authorization settings ...
<membership defaultProvider='CustomizedProvider'>
<providers>
<add name='CustomizedProvider'
type='System.Web.Security.SqlMembershipProvider'
connectionStringName='SQLConnectionString'
applicationName='CameronDWebSiteIsSweet'
minRequiredPasswordLength='5'
minRequiredNonalphanumericCharacters='0' />
</providers>
</membership>
</system.web>
</configuration>
kevinasp.com (http://kevinasp.com)
Post Edited (kkarasin) : 11/16/2006 5:05:57 AM GMT
bruce
11-16-2006, 06:46 AM
look for something like the following in your web.config file
Server=.\SQLExpress;AttachDbFilename=|DataDirector y|mydbfile.mdf;
Bruce
DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)
vBulletin® ©Jelsoft Enterprises Ltd.