I've been handed a legacy .Net Windows application that was previously used on Windows XP, and asked to debug a few problems encountered on Windows 7 clients. The original developers are all gone. I'm down to only a single error -- a seemingly common one:
"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: Named Pipes
Provider, error: 40 - Could not open a connection to SQL Server)"
Curiously, this error only occurs for ordinary users. When the application is started using "Run as Administrator" it connects to the database immediately. We believe we can configure the app to always start as an administrator, but obviously we'd like to run it without that if we can. However, I haven't seen any good suggestions why the database connection would only fail this one way.
Any ideas? I've seen at least one troubleshooting guide that suggested trying with Run as Administrator, but it didn't say how to proceed if that fixes it. Am I just supposed to stop at this point? If I was having a UI problem I might understand that some old apps just aren't going to work in Windows 7, but this is just connecting to the database. Seems like we should be able to do this. I just don't know what to check.
Thanks in advance.
EDIT:
I have looked more closely at this, and perhaps there are more clues. I use the same user account to log on to two Win7 machines. One is a developer workstation with VS10 installed. The other is representative of a client workstation the app will
run on. My user account is actually an administrator on both machines.
At runtime we invoke advapi32.dll logonuser impersonation to logon to SQL server with a dedicated account.
What we're seeing is that I can run the app freely on the developer workstation. Even with UAC on, and even if I am not using "run as administrator". This may point to something about how the SQL drivers/provider are installed on that machine.
When I run on the regular user workstation, even though I am an administrator myself, I must "run as administrator" to launch it. And when I do, I get a UAC prompt. When we turn UAC off, of course, the app runs fine.