‘error 26 - error locating server’ when launching C# exe located on NW drive from Win7; MSSQL

StackOverflow https://stackoverflow.com/questions/14356401

문제

I have several C# programs utilizing LINQ to SQL classes. If I put the exe files on a network drive and execute them from there, I get the ‘error 26’, but only when I do it from Win7.

Step by step

  1. Create a new C# project (I use VS 2010 Premium on an XP machine). Add new ‘LINQ to SQL classes’. Drag and drop some table into the data context (from the server explorer). The database(s) I’m using are all MSSQL on remote servers.

  2. On the question: “The connection string contains credentials with a clear text password and is not using integrated security…”, select Yes

  3. Make some LINQ query in the program, utilizing the data context. Make sure the program works.

  4. Put the exe on a (mapped) network drive

  5. Execute the exe (from the NW location)

The connection string (as created by the system) looks as follows (from where it can be seen in the VS project; Properties -> Settings):

Data Source=SERVERNAME\INSTANCE;Initial Catalog=INITIAL_CATALOG;Persist Security Info=True;User ID=USER_ID;Password=PASSWORD

Notes

  • [On XP machine] Launch exe locally (c drive)= OK
  • [On XP machine] Launch exe from NW drive = OK
  • [On Win7 machine] Launch exe locally (c drive) = OK
  • [On Win7 machine] Launch exe from NW drive = NOT OK (error 26…)

Error message: 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)

도움이 되었습니까?

해결책

There are a no. of ways to solve this error. However. if you are using a 64 bit (new Windows 7 system, using SQL BI Development Studio)you must add your aliases under SQL Native Client 10.0 Configuration (32 bit). Check this link too.It may help : http://sqlerrormessages.blogspot.in/2009/12/specified-sql-server-not-found-or-error.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top