Why might one app connect to SQL backend OK and a second app fail if they share the same connectionstring?

Posted by hawbsl on Stack Overflow See other posts from Stack Overflow or by hawbsl
Published on 2012-07-03T13:20:32Z Indexed on 2012/07/03 15:16 UTC
Read the original article Hit count: 190

Filed under:
|
|

Trying to figure out a SQL connection error 26 in our app.

We've got two closely related apps Foo and FooAddIn. Foo is a Winforms app built in VS2010 and runs fine and connects fine to our SQLExpress back end.

FooAddIn is an Outlook AddIn which references Foo.exe and connects to the same SQL Express instance. Or rather, it doesn't connect, instead reporting:

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)

Now, both apps share the same connectionstring and we've verified they really do share the same connectionstring.

At this stage we're just testing from within the same developer machine, so the apps are on the same machine, going via the same VS2010 IDE.

So a lot of the advice online for this error doesn't apply because the fact that Foo connects through to SQL Express tells us the database is there and available and can be reached.

What else is there to check? One thing is that Foo and FooAddIn are running different runtime versions of System.Data (v2.0.50727 and v4.0.30319). Could that be a factor?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about sqlconnection