title: provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified
body: <p>I have a asp .net 2.0 web application. It works fine on my local machine. I published the website to my hosting provider but it gives the following error:</p>
  
  <pre><code>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
  </code></pre>
  
  <p>The settings in my web.config file is as follows:</p>
  
  <pre><code> &lt;membership&gt;
    &lt;providers&gt;
      &lt;clear/&gt;
      &lt;add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/&gt;
    &lt;/providers&gt;
  &lt;/membership&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;add name="classifiedsConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\CLASSIFIEDSDB.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/&gt;
  </code></pre>
  
  <p>All mdf ldf files are uploaded to the host.I have checked many similar questions on stackoverflow but the solutions didnt help me. Is it wrong to use sqlexpress in this way ? how can i fix this problem ?</p>
  
  <p>Any helps would be appreciated. thanks
  Thanks.</p>
  
  <p>Edit:</p>
  
  <p>There is no LocalSQLServer connection string in web.config file. But to make sure i tried adding this connection string</p>
  
  <pre><code>&lt;add name="LocalSqlServer" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/&gt;
  </code></pre>
  
  <p>but the result didnt change.</p>
  
  <p>Edit2:</p>
  
  <p>I updated the connectionstrings of the providers and now my web.config file is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"&gt;
    &lt;location path="Admin"&gt;
      &lt;system.web&gt;
        &lt;authorization&gt;
          &lt;allow roles="Administrators"/&gt;
          &lt;deny users="*"/&gt;
        &lt;/authorization&gt;
      &lt;/system.web&gt;
    &lt;/location&gt;
    &lt;location path="PostAd.aspx"&gt;
      &lt;system.web&gt;
        &lt;authorization&gt;
          &lt;deny users="?"/&gt;
        &lt;/authorization&gt;
      &lt;/system.web&gt;
    &lt;/location&gt;
    &lt;location path="EditPhotos.aspx"&gt;
      &lt;system.web&gt;
        &lt;authorization&gt;
          &lt;deny users="?"/&gt;
        &lt;/authorization&gt;
      &lt;/system.web&gt;
    &lt;/location&gt;
    &lt;location path="MyAds.aspx"&gt;
      &lt;system.web&gt;
        &lt;authorization&gt;
          &lt;deny users="?"/&gt;
        &lt;/authorization&gt;
      &lt;/system.web&gt;
    &lt;/location&gt;
    &lt;location path="MyProfile.aspx"&gt;
      &lt;system.web&gt;
        &lt;authorization&gt;
          &lt;deny users="?"/&gt;
        &lt;/authorization&gt;
      &lt;/system.web&gt;
    &lt;/location&gt;
    &lt;system.web&gt;
      &lt;customErrors mode="Off"/&gt;
      &lt;pages styleSheetTheme="Red"/&gt;
      &lt;authentication mode="Forms"/&gt;
      &lt;membership&gt;
        &lt;providers&gt;
        &lt;clear/&gt;
        &lt;add name="AspNetSqlMembershipProvider"
             type="System.Web.Security.SqlMembershipProvider, System.Web,     Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
             connectionStringName="membershipConnection"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="true"
             applicationName="/"
             requiresUniqueEmail="true"
             passwordFormat="Hashed"
             maxInvalidPasswordAttempts="5"
             minRequiredPasswordLength="7"
             minRequiredNonalphanumericCharacters="1"
             passwordAttemptWindow="10"
             passwordStrengthRegularExpression=""/&gt;
      &lt;/providers&gt;
      &lt;/membership&gt;
      &lt;profile enabled="true"&gt;
        &lt;properties&gt;
          &lt;add name="FirstName" type="System.String"/&gt;
          &lt;add name="LastName" type="System.String"/&gt;
          &lt;add name="MemberId" defaultValue="0" type="System.Int32"/&gt;
          &lt;group name="Core"/&gt;
        &lt;/properties&gt;
      &lt;/profile&gt;
      &lt;roleManager enabled="true"/&gt;
      &lt;compilation debug="true"/&gt;
      &lt;siteMap defaultProvider="RoleEnabled_AspNetXmlSiteMapProvider" enabled="true"&gt;
        &lt;providers&gt;
          &lt;clear/&gt;
          &lt;add name="RoleEnabled_AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" siteMapFile="web.sitemap" securityTrimmingEnabled="true"/&gt;
        &lt;/providers&gt;
      &lt;/siteMap&gt;
    &lt;/system.web&gt;
    &lt;connectionStrings&gt;
      &lt;add name="classifiedsConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\CLASSIFIEDSDB.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/&gt;
  &lt;add name="membershipConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/&gt;
    &lt;/connectionStrings&gt;      
  &lt;/configuration&gt;
  </code></pre>
  
  <p>and i have aspnetdb.mdf and classifieds.mdf files in may app_data folder, but it still doesnt work. the full text of the error im getting is:</p>
  
  <p><em><code>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)</code>"</em></p>