Code Comments
Programming Forum and web based access to our favorite programming groups.Are there any C# Discussion Groups that handle the development of Windows Services? Nearly every other grouping seems to be covered but this. I have an issue with a Windows Service accessing a SQL Server database. The SQLException thrown also has the following: Message @"Login failed for user 'aserverName\ZBPL-908R01J-L$'." I was calling a stored proc with a defined SQL Server user with permissions on selected objects in a particular database configured in the connection string. It appeared to ignore that and use the machine name instead presumably because the Windows Service was configured to use the localSystem account. What do I need to do for SQL Server to allow access to the machine? Create the machine as a user and allocate permissions to objects? -- PeterW
Post Follow-up to this messageHi, I don't think you'll get much joy from the C# and .NET community on this as they're still in nappies. If you're using "Windows Integrated Authentication", one thing you could try, is defining a special domain account "SQLAccess" (or whatever) and tell your service to run as that account. Make sure SQL server has that account in it's list of allowed logins. PeterW wrote: > Are there any C# Discussion Groups that handle the development of Windows > Services? Nearly every other grouping seems to be covered but this. > > I have an issue with a Windows Service accessing a SQL Server database. T he > SQLException thrown also has the following: Message @"Login failed for us er > 'aserverName\ZBPL-908R01J-L$'." > > I was calling a stored proc with a defined SQL Server user with permission s > on selected objects in a particular database configured in the connection > string. It appeared to ignore that and use the machine name instead > presumably because the Windows Service was configured to use the localSyst em > account. > > What do I need to do for SQL Server to allow access to the machine? Creat e > the machine as a user and allocate permissions to objects? > -- Gerry Hickman (London UK)
Post Follow-up to this messageGerry I agree. After I posted this article I changed the account that the service runs under to a user account being my own which has local administrator rights. The SQL user used for the connection string is a specially defined user having priviledges just to the objects that the service needs to write to. All this is in a service that runs a filewatcher that fires off new threads to process the dropped files. All works beautifully. So to roll it out I need to talk to the systems administrators to create a user account just for the service as you suggest. That is a setup issue. Thanks for your input. It helped to confirm after the event that the choices I had deduced were indeed valid. cheers "Gerry Hickman" wrote: > Hi, > > I don't think you'll get much joy from the C# and .NET community on this > as they're still in nappies. > > If you're using "Windows Integrated Authentication", one thing you could > try, is defining a special domain account "SQLAccess" (or whatever) and > tell your service to run as that account. Make sure SQL server has that > account in it's list of allowed logins. > > PeterW wrote: > > > > -- > Gerry Hickman (London UK) >
Post Follow-up to this messageHi Peter, > All works beautifully. So to roll it out I need to talk to the systems > administrators to create a user account just for the service as you suggest.[/colo r] Great! Glad it was useful. -- Gerry Hickman (London UK)
Post Follow-up to this messagePeter, If you specify a username/password combination in your connection string you should not have to run the servers using an special SQLAccess-account! I use a connectionstring like the following for my services: "Data Source=SQLSERVERNAME; Initial Catalog=DATABASENAME; User ID=USERID; Password=PASSWORD;" This works like a charm and doesn't require a special sql-access account.. Erik "PeterW" <nspw@noemail.nospam> wrote in message news:16274C08-CBC2-4240-93AB-9CF1E754EBC5@microsoft.com... > Gerry > > I agree. After I posted this article I changed the account that the service > runs under to a user account being my own which has local administrator > rights. The SQL user used for the connection string is a specially defined > user having priviledges just to the objects that the service needs to write > to. All this is in a service that runs a filewatcher that fires off new > threads to process the dropped files. > > All works beautifully. So to roll it out I need to talk to the systems > administrators to create a user account just for the service as you suggest. > That is a setup issue. > > Thanks for your input. It helped to confirm after the event that the > choices I had deduced were indeed valid. > > cheers > > "Gerry Hickman" wrote: > Windows database. The user permissions connection localSystem Create
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.