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. Web Development
  3. ASP.NET
  4. execute a certain task every one hour in server

execute a certain task every one hour in server

Scheduled Pinned Locked Moved ASP.NET
csharpsysadmin
10 Posts 7 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.
  • F Offline
    F Offline
    Farhad Eft
    wrote on last edited by
    #1

    Hi I want to a certain task every one hour in server in my ASP .NET 4 project, I was wondering where should i put my codes to execute. Thank you guys

    F R L D S 6 Replies Last reply
    0
    • F Farhad Eft

      Hi I want to a certain task every one hour in server in my ASP .NET 4 project, I was wondering where should i put my codes to execute. Thank you guys

      F Offline
      F Offline
      fjdiewornncalwe
      wrote on last edited by
      #2

      For starters, don't put repetitive server code in a web application because then you will need something to trigger the process anyway. Why not investigate using a Windows Service or an application that is setup to be run by the Windows Task Scheduler.

      I wasn't, now I am, then I won't be anymore.

      F 1 Reply Last reply
      0
      • F Farhad Eft

        Hi I want to a certain task every one hour in server in my ASP .NET 4 project, I was wondering where should i put my codes to execute. Thank you guys

        R Offline
        R Offline
        Rahul Rajat Singh
        wrote on last edited by
        #3

        The best way to do this is by writing a windows service and run it on the server. this windows service can be written in such a way that it will do some particular task every hour.

        Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.

        F 1 Reply Last reply
        0
        • F fjdiewornncalwe

          For starters, don't put repetitive server code in a web application because then you will need something to trigger the process anyway. Why not investigate using a Windows Service or an application that is setup to be run by the Windows Task Scheduler.

          I wasn't, now I am, then I won't be anymore.

          F Offline
          F Offline
          Farhad Eft
          wrote on last edited by
          #4

          thank you so much for your answer but i only have a shared hosting plan not a dedicated server and i definitely don't have access to those kinds of resources.

          1 Reply Last reply
          0
          • R Rahul Rajat Singh

            The best way to do this is by writing a windows service and run it on the server. this windows service can be written in such a way that it will do some particular task every hour.

            Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.

            F Offline
            F Offline
            Farhad Eft
            wrote on last edited by
            #5

            thank you so much for your answer but i only have a shared hosting plan not a dedicated server and i definitely don't have access to those kinds of resources.

            R 1 Reply Last reply
            0
            • F Farhad Eft

              thank you so much for your answer but i only have a shared hosting plan not a dedicated server and i definitely don't have access to those kinds of resources.

              R Offline
              R Offline
              Rahul Rajat Singh
              wrote on last edited by
              #6

              In that case, I will have to suggest a very very dirty workaround for tackling this problem. 1. Have a page that will do the required task. do the required task only when a specific query string is present. This way you will ensure that only you know this actual link that will perform this operation. 2. Now whenever you access this page with this specific query string this task will run. you can do it manually but you can still automate it. lets see how: 3. create a simple winform application with webbrowser control in it and navigate it to the required page with the specific querystring. all hard coded in the page_load. so when application opens up your task is done. close this app in webbrowser navigated event. 4. Now configure a windows service on your PC that will run this application on a specified time. P.S. all this assuming that the task you need to perform is not time consuming otherwise you will get timeout problem. Note: I am not recommending this approach. it is very very bad. but in desperate times such workarounds do work.

              Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.

              1 Reply Last reply
              0
              • F Farhad Eft

                Hi I want to a certain task every one hour in server in my ASP .NET 4 project, I was wondering where should i put my codes to execute. Thank you guys

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Put ur code as console appln. Use server task-scheduler to trigger that .exe file every hour...

                1 Reply Last reply
                0
                • F Farhad Eft

                  Hi I want to a certain task every one hour in server in my ASP .NET 4 project, I was wondering where should i put my codes to execute. Thank you guys

                  D Offline
                  D Offline
                  David Mujica
                  wrote on last edited by
                  #8

                  Is this a task SQL server based? maybe you could write a SQL job and have it scheduled. (if your hosting agreement allows it) Just a thought.

                  1 Reply Last reply
                  0
                  • F Farhad Eft

                    Hi I want to a certain task every one hour in server in my ASP .NET 4 project, I was wondering where should i put my codes to execute. Thank you guys

                    S Offline
                    S Offline
                    Sandip Nascar
                    wrote on last edited by
                    #9

                    As you are using shared hosting, it is not possible to connect to windows service as this will not be allowed. Create a web page which will do the task (as per your requirement - say adding some data or sending mail etc). Use query string to specify your parameters. Don't forget to encrypt the querystring value for security concern. Now the interesting thing, create a windows service in your local machine which calls the above mentioned aspx page with querystring value. Thus the page is fired in background and the code behind of the page will do the rest. Thanks, Sandip

                    1 Reply Last reply
                    0
                    • F Farhad Eft

                      Hi I want to a certain task every one hour in server in my ASP .NET 4 project, I was wondering where should i put my codes to execute. Thank you guys

                      V Offline
                      V Offline
                      Vijay Selvaraj
                      wrote on last edited by
                      #10

                      hi can you use timer control and set timer interval to hours to milisecod

                      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