SqlConnection and service program

IfYouSaySo

Well-known member
Joined
Jan 4, 2006
Messages
102
Location
Hermosa Beach, CA
Programming Experience
3-5
Hi,

I have a sql database (server 2008) and I have a simple update program that works from the command line, and I have a separate windows service program that serves out data via remoting. My problem is:

1) the updater and the service program work on my desktop box (XP Home)
2) the update works on a production box, server 2003
3) the service program on the server 2003 says the sql instance can't be found or remote connections are not enabled. (I am reasonably certain that remote connections are enabled, and I think the updater program would not work anyway if remote connections were disabled).

I have tried running the service program (on server 2003) as both LocalSystem and domain/administrator accounts. I have tried using both of these connection strings:

server=xxx;database=xxx;uid=xxx;pwd=xxx;integrated security=sspi

AND

server=xxx;database=xxx;integrated security=true

The one that is currently configured and works for the updater, from the command line, is the one with "integrated security=true".

Does anyone have ideas on what might be happening?

Thanks...
 
does the service run under an account that is allowed to access the db? does the service run from a location/under credentials that is allowed db or net access from a .net security point of view?
 
I figured it out...the app.config file did not have the connection string. Only I thought that it *did* have a connection string, because since the db connection logic was in myapp.dll VC++ puts the config info into myapp.dll.config. So I figured that was the right place for it...

I guess it makes sense that the configs for a dll should be held in the calling application, but now, I wish the app would THROW if it can't find a config, so I know that's what happened. Instead of just returning an empty string. And I realize that some configs are ignorable, but the app should at least be able to decide that 'hey, I don't think my configs are ignorable, so I'd rather have the runtime throw if they're missing.'

And I'm still not sure why it worked when running under visual studio but not when I copied files onto the production box...

Anyway. A lot of wasted time.
 
Back
Top