Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. can application service start without being logged in?

can application service start without being logged in?

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpquestion
10 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    neodeaths
    wrote on last edited by
    #1

    does anyone know if i can create a .net application as a service which would still be started even if the user restart and doesn't log in?

    D A A M 4 Replies Last reply
    0
    • N neodeaths

      does anyone know if i can create a .net application as a service which would still be started even if the user restart and doesn't log in?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      That's kind of the definition of a Windows Service application. They run when Windows starts, not when a user logs in. If you were thinking that you were going to write a service application that puts up a user interface the user can see, forget it. That's not allowed for security reasons. If you wanted to do something like that, you'd be writing TWO applications. One would be the service that is constantly running and the other would be a normal application that runs when the user logs in and communicates with the service over an IPC method of your choice.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      N 1 Reply Last reply
      0
      • D Dave Kreskowiak

        That's kind of the definition of a Windows Service application. They run when Windows starts, not when a user logs in. If you were thinking that you were going to write a service application that puts up a user interface the user can see, forget it. That's not allowed for security reasons. If you wanted to do something like that, you'd be writing TWO applications. One would be the service that is constantly running and the other would be a normal application that runs when the user logs in and communicates with the service over an IPC method of your choice.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        N Offline
        N Offline
        neodeaths
        wrote on last edited by
        #3

        ah ic, thanks you very much. i am probably gonna create two application. though i never used an IPC method before.

        D 1 Reply Last reply
        0
        • N neodeaths

          ah ic, thanks you very much. i am probably gonna create two application. though i never used an IPC method before.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          neodeaths wrote:

          i never used an IPC method before.

          IPC Stands for "InterProcess Communication". Read this[^]. I would suggest using Named Pipes.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          1 Reply Last reply
          0
          • N neodeaths

            does anyone know if i can create a .net application as a service which would still be started even if the user restart and doesn't log in?

            A Offline
            A Offline
            Abhinav S
            wrote on last edited by
            #5

            All services start before login so the service should start even if the user does not login.

            WP Apps - Color Search | Arctic | XKCD | Sound Meter | Speed Dial

            1 Reply Last reply
            0
            • N neodeaths

              does anyone know if i can create a .net application as a service which would still be started even if the user restart and doesn't log in?

              A Offline
              A Offline
              Anna King
              wrote on last edited by
              #6

              I don't think that it is possible to create such kind of application service, but you can try it your way.

              1 Reply Last reply
              0
              • N neodeaths

                does anyone know if i can create a .net application as a service which would still be started even if the user restart and doesn't log in?

                M Offline
                M Offline
                Marco Bertschi
                wrote on last edited by
                #7

                A windows system service starts as soon as Windows is started - Remember that a service may not be able to access user-specific folders and files when the respective user is not logged in! - MB

                cheers Marco Bertschi


                Twitter | Articles


                You have absolutely no idea how glad I am that I have no idea at all. - OriginalGriff I'm at peace with the world and myself. - Me

                N 1 Reply Last reply
                0
                • M Marco Bertschi

                  A windows system service starts as soon as Windows is started - Remember that a service may not be able to access user-specific folders and files when the respective user is not logged in! - MB

                  cheers Marco Bertschi


                  Twitter | Articles


                  You have absolutely no idea how glad I am that I have no idea at all. - OriginalGriff I'm at peace with the world and myself. - Me

                  N Offline
                  N Offline
                  neodeaths
                  wrote on last edited by
                  #8

                  if i need to save a little bit of application data. what can i use besides database and still be sure that i will have access to it?. should i use registry? or save the data in an flat file in the program files?

                  D 1 Reply Last reply
                  0
                  • N neodeaths

                    if i need to save a little bit of application data. what can i use besides database and still be sure that i will have access to it?. should i use registry? or save the data in an flat file in the program files?

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    You can't save anything to program files or below. It's readonly to normaly users. You can get the path to an appropriate place to put your data from this list[^]. Use Environment.GetFolderPath[^] to get that path, then combine it with your data filename using Path.Combine[^].

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak

                    M 1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      You can't save anything to program files or below. It's readonly to normaly users. You can get the path to an appropriate place to put your data from this list[^]. Use Environment.GetFolderPath[^] to get that path, then combine it with your data filename using Path.Combine[^].

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak

                      M Offline
                      M Offline
                      Marco Bertschi
                      wrote on last edited by
                      #10

                      :thumbsup: I'd recommend the "CommonApplicationData" folder because it is accessible by all users. cheers, Marco

                      **Marco Bertschi


                      Twitter | Articles | G+**

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups