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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. windows service error

windows service error

Scheduled Pinned Locked Moved C#
helpperformancetutorial
15 Posts 4 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
    NarendraSinghJTV
    wrote on last edited by
    #1

    hey all with the help of eduard's response for my previuos message "windows service installation" i have installed my application and service both, but when i start my service it is giving following message and stops "the service on local computer started and stopped. Some services stop automatically if they have no work to do for example the performance logs and alert services" can u help me with this thanks for responses regards narendra singh

    S A 2 Replies Last reply
    0
    • N NarendraSinghJTV

      hey all with the help of eduard's response for my previuos message "windows service installation" i have installed my application and service both, but when i start my service it is giving following message and stops "the service on local computer started and stopped. Some services stop automatically if they have no work to do for example the performance logs and alert services" can u help me with this thanks for responses regards narendra singh

      S Offline
      S Offline
      ScottM1
      wrote on last edited by
      #2

      The message is self explanatory, your service is starting, finishing processing whatever you told it to, and then stopping. What is the service supposed to be doing that would keep it running?

      N 1 Reply Last reply
      0
      • S ScottM1

        The message is self explanatory, your service is starting, finishing processing whatever you told it to, and then stopping. What is the service supposed to be doing that would keep it running?

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

        yes scott i m agree with u but it is not performing the actions defined within onstart(), service have to send a message and then it should be stop

        S 1 Reply Last reply
        0
        • N NarendraSinghJTV

          hey all with the help of eduard's response for my previuos message "windows service installation" i have installed my application and service both, but when i start my service it is giving following message and stops "the service on local computer started and stopped. Some services stop automatically if they have no work to do for example the performance logs and alert services" can u help me with this thanks for responses regards narendra singh

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          Debug your services. It throwing some exception at runtime ! :) That's why you are getting this message.

          Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

          N 1 Reply Last reply
          0
          • N NarendraSinghJTV

            yes scott i m agree with u but it is not performing the actions defined within onstart(), service have to send a message and then it should be stop

            S Offline
            S Offline
            ScottM1
            wrote on last edited by
            #5

            Where is it sending a message? Is it connecting to a server socket and sending a message or what?

            N 1 Reply Last reply
            0
            • S ScottM1

              Where is it sending a message? Is it connecting to a server socket and sending a message or what?

              N Offline
              N Offline
              NarendraSinghJTV
              wrote on last edited by
              #6

              actually it is sending a e-mail message to wish happy birthday by taking the dob from the database

              S 1 Reply Last reply
              0
              • A Abhijit Jana

                Debug your services. It throwing some exception at runtime ! :) That's why you are getting this message.

                Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

                N Offline
                N Offline
                NarendraSinghJTV
                wrote on last edited by
                #7

                yes abhijit u r absolutely right it is throwing an exception actually i m using single database in both application as well as service. but sql server is not allowing to access the database which is already in use, it is generating a error which says .mdf file is already in use thanks for ur response

                1 Reply Last reply
                0
                • N NarendraSinghJTV

                  actually it is sending a e-mail message to wish happy birthday by taking the dob from the database

                  S Offline
                  S Offline
                  ScottM1
                  wrote on last edited by
                  #8

                  Then it is probably sending the e-mail and failing but it is not notifying you that it failed. Try running the code in a normal application and see if the e-mail is sent. What account are you running the service under?

                  N 1 Reply Last reply
                  0
                  • S ScottM1

                    Then it is probably sending the e-mail and failing but it is not notifying you that it failed. Try running the code in a normal application and see if the e-mail is sent. What account are you running the service under?

                    N Offline
                    N Offline
                    NarendraSinghJTV
                    wrote on last edited by
                    #9

                    actually i m using single database in both application as well as service. but sql server is not allowing to access the database which is already in use, it is generating a error which says .mdf file is already in use, i m running service under local system thanks for ur response

                    S 1 Reply Last reply
                    0
                    • N NarendraSinghJTV

                      actually i m using single database in both application as well as service. but sql server is not allowing to access the database which is already in use, it is generating a error which says .mdf file is already in use, i m running service under local system thanks for ur response

                      S Offline
                      S Offline
                      ScottM1
                      wrote on last edited by
                      #10

                      If it is giving the error that the mdf file is already in use then it is probably a MS Access database and you probably have the database open in access or you did not close the connection properly and the database is still locked. Is there an ldb file in the same directory?

                      N 1 Reply Last reply
                      0
                      • S ScottM1

                        If it is giving the error that the mdf file is already in use then it is probably a MS Access database and you probably have the database open in access or you did not close the connection properly and the database is still locked. Is there an ldb file in the same directory?

                        N Offline
                        N Offline
                        NarendraSinghJTV
                        wrote on last edited by
                        #11

                        ok let me explain i m creating a application in which i want a functionality of wishing happy birthday automatically to the customers by sending email by taking there dob from the customer table which is in sql server 2005 database, so i added a windows service project in same solution and done all the coading in onstart(), i also created a setup which install both application and service on the local system, after installing when i try to start the service then problem occurs, i provided connection string for the database also, can we use single database in different projects in same solution, i think now the problem is clear to you. waiting for ur response thanks

                        S A 2 Replies Last reply
                        0
                        • N NarendraSinghJTV

                          ok let me explain i m creating a application in which i want a functionality of wishing happy birthday automatically to the customers by sending email by taking there dob from the customer table which is in sql server 2005 database, so i added a windows service project in same solution and done all the coading in onstart(), i also created a setup which install both application and service on the local system, after installing when i try to start the service then problem occurs, i provided connection string for the database also, can we use single database in different projects in same solution, i think now the problem is clear to you. waiting for ur response thanks

                          S Offline
                          S Offline
                          ScottM1
                          wrote on last edited by
                          #12

                          If it is an MS Access database you could have problems accessing it from multiple projects simultaneously depending on how you connect to the database. I think that instead of using a Windows service you should just build a simple console application that runs once a day from task scheduler.

                          N 1 Reply Last reply
                          0
                          • S ScottM1

                            If it is an MS Access database you could have problems accessing it from multiple projects simultaneously depending on how you connect to the database. I think that instead of using a Windows service you should just build a simple console application that runs once a day from task scheduler.

                            N Offline
                            N Offline
                            NarendraSinghJTV
                            wrote on last edited by
                            #13

                            hey scott thanks for ur all replys, now i have added this functionality in application itself, with the help of functions, which checks the date from database and send mail automatically to the contact. thanks for ur responses regards narendra singh

                            1 Reply Last reply
                            0
                            • N NarendraSinghJTV

                              ok let me explain i m creating a application in which i want a functionality of wishing happy birthday automatically to the customers by sending email by taking there dob from the customer table which is in sql server 2005 database, so i added a windows service project in same solution and done all the coading in onstart(), i also created a setup which install both application and service on the local system, after installing when i try to start the service then problem occurs, i provided connection string for the database also, can we use single database in different projects in same solution, i think now the problem is clear to you. waiting for ur response thanks

                              A Offline
                              A Offline
                              Ashfield
                              wrote on last edited by
                              #14

                              NarendraSinghJTV wrote:

                              done all the coading in onstart(),

                              Well don't. OnStart is just for that. Move your code and try debugging by connecting to your service from the ide - and you cannot debug the OnStart code. Also try logging errors soemwhere (say a file) so you can see whats going wrong.

                              Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

                              N 1 Reply Last reply
                              0
                              • A Ashfield

                                NarendraSinghJTV wrote:

                                done all the coading in onstart(),

                                Well don't. OnStart is just for that. Move your code and try debugging by connecting to your service from the ide - and you cannot debug the OnStart code. Also try logging errors soemwhere (say a file) so you can see whats going wrong.

                                Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

                                N Offline
                                N Offline
                                NarendraSinghJTV
                                wrote on last edited by
                                #15

                                thanks bob for ur valuable response thanks for all the responses regards narendra singh

                                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