0

So I have few ASP.NET apps all running off SQL Server Express 2008 and working fine and dandy. I just put up a new one to test something and am now getting the Error 26 - can't find instance. What's weird is that the app is talking to the DB partially because it brings up the user login page and if I enter wrong data it returns a message about that (which is good). When I enter the correct login info it takes it then thinks for a few seconds and then throws the Error 26.

Here is my connection string --

<connectionStrings>
    <add name="db_BPEntities" connectionString="metadata=res://*/App_Code.Data.db_BP.csdl|res://*/App_Code.Data.db_BP.ssdl|res://*/App_Code.Data.db_BP.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=LOCALHOST\SQLEXPRESS;initial catalog=db_BC_Build;user id=USER;password=PASSWORD;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="Default" connectionString="server=LOCALHOST\SQLEXPRESS;database=db_BC_Build;USER ID=USER;password=PASSWORD;Min Pool Size=10;Max Pool Size=800;Network Library=dbmssocn" providerName="System.Data.SqlClient" />      
</connectionStrings>

Note: I've changed user/password info. The DB is running locally off the same box with IIS (it's a test intranet site so I'm ok with that for now).

So summary:

  1. Other apps running off same DB have zero connectivity issues. They all connect and work fine.
  2. This app partially works but on login throws the Error 26 - Instance not found.
  3. Would it be that there are 2 connection strings here vs 1 connection string on my other DBs?

Really stumped.

Thanks for any/all help :)

Edit: I think the issue is with the Entity Framework and SQL Server Express. It seems to connect initially to authenticate the user, but then the EF connectivity to display data, etc is where it breaks. That's where I'm at right now and stuck in trying to figure this out (I didn't develop this application).

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Valien
  • 1,125
  • 2
  • 17
  • 38

3 Answers3

1

Try to connect without "Network Library=dbmssocn" in your connectionstring. I have had the same (error 26) issue and it did work for me.

Michiel
  • 36
  • 2
  • That worked. Not sure why but it did. Gotta go google it now to find out why this works fine on SQL Server but not on SQL Server Express. Thanks for the tip! – Valien May 08 '12 at 18:56
0

To quote from SQL Network Interfaces, error: 26, these are the steps to overcome this issue:

  1. Make sure your server name is correct, e.g., no typo on the name.
  2. Make sure your instance name is correct and there is actually such an instance on your target machine. [Update: Some application converts \\ to \. If you are not sure about your application, please try both Server\Instance and Server\\Instance in your connection string]
  3. Make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true).
  4. Make sure SQL Browser service is running on the server.
  5. If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.

Please visit the link for more detail.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Ashwini Verma
  • 7,477
  • 6
  • 36
  • 56
  • Tried all this to no avail and with all other apps running fine with the exact same instance (just different DB's) some of this doesn't apply. – Valien Apr 06 '12 at 14:13
0

I change app config file to this

<connectionStrings>

  <!--  TLPL_ICT_OPR\MSSQLSERVER1;Initial Catalog=FMS;User ID=fms -->


  <add name="DBConnectionString" connectionString="user id=fms;data source=TLPL_ICT_OPR\MSSQLSER;persist security info=True;initial catalog=username;password=password" providerName="System.Data.SqlClient"/>
  <!--<add name="DBConnectionString" connectionString="user id=fms;data source=TLPL_ICT_PHOLIB\SQLEXPRESS;persist security info=True;initial catalog=FMS;password=fms4321"
       providerName="System.Data.SqlClient" />-->
 </connectionStrings>

 <startup>
   <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
 </startup>

after this it works fine....

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123