Windows Service Problem

Posted on 2005-04-21
Last Modified: 2010-04-23
Hi All,

I have developed an application that uses a number of xml schema's to handle data updates, selects etc. The application runs fine however when I put the same code into a windows service timer event the connection falls over with a "login failed for user DomainName\MachineName". The connection string I am using is the same as in the application so I'm not sure why the DomainName\MachineName is coming up in the login failure message.

Any help much appreciated

Question by:rossc007
    LVL 44

    Expert Comment

    Hi rossc007,

    Probably because the service is running under the localsystem account and you are using integrated security. This is a common issue with services, you have to either run the service under a domain account that has the appropriate security permissions or use SQL security rather than integrated security and specify the user name and password within your connection string.

    Tim Cottee

    Author Comment

    Hi Tim,

    I've tried the user name and password in my connection string, and as before it ran perfectly from the application, but failed on the service. I dont think it will make any diffence but I would like to try your first suggestion, how do I run the service from a domain account?


    LVL 44

    Accepted Solution


    If you run the services.msc either from a command line or by going into "administrative tools" from the control panel, you can select your service and set the the account details under which the service is run.


    Author Comment

    Hi Tim,

    Thanks for that, seems to have done some good but I'm still getting problems. The Login Failed message has gone but I am now getting a message saying that the system can't find the Stored Procedure I'm looking at, also another error saying invalid field name on a differnet adapter. I'd imagine from the results that the login is along the right track but I'm using my login for the service and I have full access to the DB. I see that some services run as network service, perhaps thats the key.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Suggested Solutions

    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now