SQL Server: error 26 when hosted, but not from local machine?

Discussion in 'ASP.NET 2.0' started by bcsmith, Apr 25, 2008.

  1. Thanks. I have turned off the fp extensions. thanks to a separate post I think I now know how to do this...

    In reading about sql server error 26 I can across something about aspnet_regsql.exe to merge a db I have never head of database.mdf with my aspnet.mdf.... I ran this script with everything pointing to my discountasp.net database and it ran o.k. but I still have the same problem. I can see no change in my web.config as a result of running the wizard.

    Here is my web.config:


    <configuration xmlns='http://schemas.microsoft.com/.NetConfiguration/v2.0'>

    <configSections>
    <section name='PredominantUse' type='PredominantUse.PredominantUseSection, __code'/>
    </configSections>

    <PredominantUse defaultConnectionStringName='predominantConnectionString'>
    <MailFrom mailFrom ='[email protected]'
    mailSubject ='PredominantUse Mail: {0}'/>
    <ContactUs mailTo ='[email protected]'
    mailSubject ='PredominantUse Client email : {0}'/>
    <Meter pageSize ='10'/>

    <ClientEquipment pageSize ='10'/>
    <Equipment pageSize ='3'/>
    <TaskAssignment pageSize ='5'/>
    <Study pageSize ='10' />
    </PredominantUse>

    <appSettings>
    <add key='CSSFriendly-JavaScript-Path' value='~/JavaScript' />
    </appSettings>

    <system.web>
    <pages theme='Simple'/>
    <compilation debug='true'/>
    </system.web>

    <connectionStrings>
    <add name='aspnetdb' connectionString='Data Source=tcp:sql2k502.discountasp.net;Initial Catalog=*****;User ID=*****;Password=****;'/>
    <add name='predominantConnectionString' connectionString='Data Source=tcp:sql2k502.discountasp.net;Initial Catalog=*****;User ID=*****;Password=****;' providerName='System.Data.SqlClient' />
    <add name='VirtualFiles' connectionString='Data Source=tcp:sql2k502.discountasp.net;Initial Catalog=*****;User ID=*****;Password=****;' />
    </connectionStrings>

    <system.web>
    <roleManager enabled='true'/>
    <authentication mode='Forms'/>
    <membership defaultProvider='SqlMembershipProvider' userIsOnlineTimeWindow='15'>
    <providers>
    <clear/>
    <add name ='SqlMembershipProvider'
    type ='System.Web.Security.SqlMembershipProvider'
    connectionStringName ='aspnetdb'
    applicationName ='PredominantUse'
    minRequiredPasswordLength ='2'
    minRequiredNonalphanumericCharacters ='0'
    passwordStrengthRegularExpression =''/>
    </providers>
    </membership>
    </system.web>


    <system.web>
    <siteMap enabled='true' >
    <providers>
    <add name='MenuProvider'
    type='System.Web.XmlSiteMapProvider,
    System.Web,
    Version=2.0.3600.0,
    Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a'
    securityTrimmingEnabled='true'
    siteMapFile='menu.sitemap'/>
    </providers>
    </siteMap>
    </system.web>

    <system.web>
    <caching>
    <sqlCacheDependency enabled='true' pollTime='5000'>
    <databases>
    <add
    name='VirtualFiles'
    connectionStringName='VirtualFiles' />
    </databases>
    </sqlCacheDependency>
    </caching>
    </system.web>


    <system.net>
    <mailSettings>
    <smtp deliveryMethod=' Network ' from='[email protected]'>
    <network host='{localhost}' port='25' />
    </smtp>
    </mailSettings>
    </system.net>
    </configuration>
     
  2. OK bro we'll get you through this...

    I saw you posting for help in the IIS forums:
    http://forums.iis.net/p/1130485/1795682.aspx

    And even before you posted your web.config here I wondered where you got some of those settings.

    Is this a Starter Kit of some kind?

    If not I'd suggest you get rid of that web.config and start with a new one.
    Will be a lot easier than fixing that one.

    I'm not trying to be harsh, just honest. [​IMG]

    The latest Microsoft Dev IDEs can create the web.config for you.
    All you have to do is remove the current one, just move it someplace out of the project.
    Then run your site locally in debug mode, the IDE will ask if you want a web.config, answer Yes.
     
  3. I got the setting from a variety of places.... and I have been struggling to get them right. Every now and then I find out more things I have wrong in my web.config.
    But to answer your question, nope this is not a starter kit. I got some of the setting from info on membership, other settings on info about VirtualFiles and others on how to configure an application to use connectionElements.

    Can you point out what is wrong?

    The only thing I can see wrong is that I have three connectionStrings to one file. This is because discountasp.net requires one database file. Before uploading I had three separate databases....this does not seem to be the problem....is there something else wrong?
     
  4. By the way I am not using the latest IDE. I am using VWD express 2005. So I don't think I can create this file from the IDE...at least not entirely. I know the IDE can create a part of it, but can express 2005 do it all? If so how?
     
  5. I can create a default web.config for you and add your conn string to it.
    Are you on a 2003 or 2008 server here?
     
  6. I am using 2003 server (I hope)....this is what it should be, but I can't find the actual reference on the control panel.
     
  7. Bruce

    Bruce DiscountASP.NET Staff

    Try this.... change following section

    <connectionStrings>
    <add name="aspnetdb" connectionString="Data Source=tcp:sql2k502.discountasp.net;Initial Catalog=*****;User ID=*****;Password=****;"/>
    <add name="predominantConnectionString" connectionString="Data Source=tcp:sql2k502.discountasp.net;Initial Catalog=*****;User ID=*****;Password=****;" providerName="System.Data.SqlClient" />
    <add name="VirtualFiles" connectionString="Data Source=tcp:sql2k502.discountasp.net;Initial Catalog=*****;User ID=*****;Password=****;" />
    </connectionStrings>

    TO -->

    <connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sql2k502.discountasp.net;Initial Catalog=*****;User ID=*****;Password=****;"/>
    <add name="aspnetdb" connectionString="Data Source=tcp:sql2k502.discountasp.net;Initial Catalog=*****;User ID=*****;Password=****;"/>
    <add name="predominantConnectionString" connectionString="Data Source=tcp:sql2k502.discountasp.net;Initial Catalog=*****;User ID=*****;Password=****;" providerName="System.Data.SqlClient" />
    <add name="VirtualFiles" connectionString="Data Source=tcp:sql2k502.discountasp.net;Initial Catalog=*****;User ID=*****;Password=****;" />
    </connectionStrings>



    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  8. I have replaced the use of LocalServer in the <membership> <providers> with the aspnetdb. Should I set this back to localServer? otherwise I don't see LocalServer being used anywhere???
     
  9. o.k. I have just updated my entire site (in case there was a problem left over from when I used to use fp extension) and I did your change....I still don't understand it but my site now comes up!!!!!!!!!! Thank you
     
  10. Bruce

    Bruce DiscountASP.NET Staff

  11. I am getting a SQLServer connection error when I try to run my application from the discountasp.net server. I deployed the application to the remote server using VWD Express 2005 [using the 'Copy Web' feature]. I have frontpage extension turned on...which I am not sure if this is the right thing.

    I have successfully uploaded the databases to the SQLServer 2005 (also at discountasp.net) machine. Then from my development machine I updated the web.config to point to the remote SQL Server 2005 machine and still ran the application on my local machine....AND THIS WORKED....i.e. I am using a REMOTE SQL Server host from my LOCAL machine and it works....but when I try to copy the web.config to the remote IIS machine at discountasp.net and run it I get the following error:



    This makes no sense to me.....I am accessing the SQL Server remotely from my machine AND the remote IIS installation. Yet my machine works and the remote IIS location does not??????



    Server Error in '/puse' Application.
    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)
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: 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)
     
  12. Can you post the web.config, (but comment out any sensitive parts)?
    Salute,
    Mark

    PS - If you don't need FPE I would strongly suggest you turn them off now.
     

Share This Page