Forum guidelines
  • Home
  • »
  • SQL Server
  • »
  • SQL Connection Error when run application(Production Server)
AuthorQuestion
SQL Connection Error when run application(Production Server)
Posted By ToBe on 07 Apr 2013
Hi Everyone 

I'm getting the follwoing error  when I configure my Application in the production server 
It's working perfect in my machine :

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)


I tried all of the articals to enable the TCP/IP and allow remote access and so many 

but still it's not working form me I double checked my connectionString name and still the same error :

this is my Web.config code :


<?xml version="1.0"?><!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  --><configuration>
<appSettings>
     <add key="CrystalImageCleaner-AutoStart" value="true" />
     <add key="CrystalImageCleaner-Sleep" value="60000" />
     <add key="CrystalImageCleaner-Age" value="120000" />
 </appSettings>
 <connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<add name="SurveyConnectionString" connectionString="Data Source=TESTSRV;Initial Catalog=MYDB;User ID=***;Password=***" providerName="System.Data.SqlClient" />
   <add name="ADConnectionString"
       connectionString="LDAP://SRV1445.mom.eu"/>
 
 </connectionStrings>
 
    
    <system.web>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" /></httpHandlers>
<customErrors mode="Off">

</customErrors>


<compilation debug="true" targetFramework="4.0">
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
<authentication mode="Forms">
        <forms name=".ADAuthCookie" loginUrl="~/Account/Login.aspx" timeout="43200"/>
      </authentication>
      <authorization>
        <deny users="?"/>
        <allow users="*"/>
      </authorization>
       
<membership defaultProvider="MyADMembershipProvider">
<providers>

        <clear/>
        <add name="MyADMembershipProvider"
        type="System.Web.Security.ActiveDirectoryMembershipProvider,
        System.Web, Version=2.0.0.0, Culture=neutral,
        PublicKeyToken=b03f5f7f11d50a3a"
        connectionStringName="ADConnectionString"
        attributeMapUsername="sAMAccountName"/>

       </providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear />
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode" /></handlers>
</system.webServer>
</configuration>



AuthorReply
Re: SQL Connection Error when run application(Production Server)
Posted By Arjun Walmiki on 09 Apr 2013  
u check you server name in connection string than u find the solution

Re: SQL Connection Error when run application(Production Server)
Posted By Suthish Nair on 09 Apr 2013  
Try checking the server is accessible or not. Do pinging and telnet the server. If its opened then check for the correct connection string.
Mark as Answer, on the posts reply's that helped you !!!.
ToBe
  • 0
  • 0
Re: SQL Connection Error when run application(Production Server)
Posted By ToBe on 10 Apr 2013  
I check the server name and it's correct and it's working fine .

is it because i'm using membership to the Active Directory ?? should I enable anything in the IIS7? I'm really tired i don't know what to do 

If the error is coming coz I used the membership to AD would you kindly  tell me what is the correct way to implement it  

SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.