Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8787131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:48:33+00:00 2026-06-13T21:48:33+00:00

I am struggling to this project for a long time. I am working with

  • 0

I am struggling to this project for a long time.
I am working with the windows service application. I have already created a working windows service application. Now I got a request that only authorized users can only start the service.

Here’s what I have tried.
i. read the connection string from the app.config file

<add name ="ConnectionString" connectionString="Data Source = Server_name; Initial Catalog = DB_DEV; Integrated Security = True" providerName="System.Data.SqlClient"/>

ii. pass the connection string to SqlConnection

SqlConnection myConnection = new SqlConnection(myConnectionString) //gives me error here

iii. And tried to start service as Log on – This user.

Is this the way to do it or any other way to do it? please guide me. Thanks.

note-it is in VS2010.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:48:34+00:00Added an answer on June 13, 2026 at 9:48 pm

    A Windows service runs as a single user, configured via the Services control panel as you appear to be doing. It’s unclear how the database connection is related, but you can specify which users can start and stop the service via a number of methods.

    The sc command-line tool

    Using the sc sdset <Service name> <SDDL string> you can configure permissions on the service, allowing you to control who can start/stop the service, however this requires use of the rather terse and not particularly well documented SDDL string format.

    Using subinacl

    Microsoft provides a tool called SubInACL which can be used to configure a number of permissions-related settings.

    You can use this tool to set service start/stop permissions as follows:

    subinacl.exe /service <your service name> /Grant=<user name>=TO
    

    (The "TO" indicates that the user is to be granted both Start service (T) and Stop service (O) permissions, the other permission values can be determined via subinacl /help /full).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been struggling with this for months in my project. Here's the deal:
I have been struggling with this for a while now. given a set of
I've been struggling with this error for quite some time: Redis::ProtocolError: Got 'i' as
I have been struggling with this error for 2 days now and i am
Okay, I've been struggling with this for a while now. I have a standard
I'm struggling with this error for quite long now. I am giving some snapshots
Im struggling with this one. I have a list of items and on a
Been struggling with this simple selector problem a couple of hours now and must
Been struggling with this for quite some time so any help is appreciated. Spent
I've been struggling with this for a while. Basically, I want to have two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.