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
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.
On the question: “The connection string contains credentials with a clear text password and is not using integrated security…”, select Yes
Make some LINQ query in the program, utilizing the data context. Make sure the program works.
Put the exe on a (mapped) network drive
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)