Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Sir/Madam,
I have developed a website. Everything is running fine except one problem. Actually i need to run a form to find whether particular day has some events or not if event then send a message to that client like birthday wishes, anniversary wishes etc. and i have a table for that . But i don't know how to schedule that task in shared hosting.

What I have tried:

I tried to make a windows service to that thing. its work good on local machine because i have installed that service in my local computer but i had googled it i found that we cant installed window service on shared hosting.
Posted
Updated 28-Jun-16 22:50pm
Comments
Sergey Alexandrovich Kryukov 29-Jun-16 11:55am    
There is no such concept as "run a form". A form is rendered on HTTP request and generates some HTTP request, that's it.
You can use server push to render something on a page when some event on a server side is handled, but this is a different thing.
—SA
kimi2017 4-Jul-16 5:00am    
If you're looking for a simpler solution, you might consider a cron services like easycron.com which will load a specific URL at a given time.

1 solution

What you need to implement is called a web job (cron job in Go Daddy). I'm not sure if Go Daddy allows exe based jobs however.

Scheduling Tasks with Plesk Shared Hosting | Windows Hosting (Plesk) - GoDaddy Help[^]

I highly advise using a cloud service that is more suitable for .Net based applications, like Azure. With Azure you can schedule an exe to run at a set interval, and you can just upload this exe and it will share the same app configuration settings as your website. It would cost a bit more than GoDaddy, but you get many more features and everything is handed to you on a silver platter.

When you do make this web job, do not create a windows service, create a console application.

Good Luck!

Link to azure
Microsoft Azure: Cloud Computing Platform[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Jun-16 11:57am    
This is really useful information and might be even what the inquirer needs. But to start with, it would be important to dismiss the inquirer's "run a form" misconception.
By the way, why console application? And how would you prevent it from starting several times? Just asking...
—SA
Jacob Himes 29-Jun-16 13:36pm    
Yes you are very right the misconception needs to be addressed. I'm actually still unsure if the client met a web form or a windows form since later in the question he mentions he tried writing a windows service. It is a common misconception by beginners to create a blank windows form to perform a task that requires no user interaction.

Console applications are great for web jobs, and recommended along bat files and other script file types. The web job controls the lifetime of the application. It fires up the console application...waits for it to complete, and then will not fire it up again until the next scheduled time. Console applications when written correctly close themselves when they are done executing. If a continuous job is needed, the console app is written as an endless loop. Also, all output of the app is stored in the cloud log. This is standard in cloud solutions like Azure, BlueMix, and Amazon.

Here's a link to how a web job works in Azure.

https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/

Sergey Alexandrovich Kryukov 29-Jun-16 17:47pm    
That's right, the request is quite unclear. I still think that your information can be very useful, just not quite sure if its relevant in this particular case.

I still have doubts of those console applications. What should start them, when, on what event? With Windows Service, it's more clear; they can auto-start... I mean, if, by some reason, some HTTP request starts a console application, many can be started. Of course I understand how create a single-instance application; the problem is the very principle.

—SA
Jacob Himes 29-Jun-16 18:15pm    
The management of the console application is not taken care of by user implementation. The console application is started by a scheduled task, as In this time of day, not by a http request or a request running on a schedule. It is nearly the same as scheduling a program to run on your local machine with Windows at a certain time of day. It is executed by the fabric of the cloud environment PaaS. Windows service is not an option unless you have a virtual machine, which costs a few more dollars, OP has a shared web instance, they do not run windows services.

Of course I may be misunderstanding OP's question in the sense he wants this task to run every time a record is created, but he said "schedule" then "task", then mentioned how he cannot do it in a shared hosting instance via a windows service, so I'm at the mercy of context clues here.

FYI I totatly agree with you that invoking a new console process should never be at the end of a stateless http call.
Sergey Alexandrovich Kryukov 29-Jun-16 18:37pm    
Ah, now I understand what you meant, thank you. But then it could be not the console application, but the application without any consoles and any windows. Formally speaking, it is a "window application". Microsoft development model, especially in .NET or just in Visual Studuo, is very confusing. They suggest application types "Console" and "Window applications", but in fact, there are no such things. Those options are actually "Show console" and "Don't show console", without anything like "Windows application". On the server side, I see no point of showing anything at all. There is no one to look at that console. :-)
The output can be just logging.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900