Hi,
I have Console C# application that needs to write to a Google spreadsheet file every hour. I know that Task Scheduler is one of the solutions, but when the computer is shut down, it doesn't work. Does anyone know another solution how to run the application even though the computer is turned off? Is there any option to deploy the application to the server?
Amit MohantyPosted Jun 1, 2023, 10:24 AM
If you want your C# application to run on a schedule even when the computer is turned off, you can consider deploying the application to a server or using a cloud-based solution. Cloud platforms like Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP) offer services for hosting and running applications. You can deploy your application to a cloud server or use serverless computing options like AWS Lambda or Azure Functions. These platforms often provide built-in scheduling capabilities that allow you to trigger your application periodically.
Sam HobbsPosted Mar 18, 2024, 2:25 AM
You could use a VM. That is a type of cloud. There are Windows VMs but Linux VMs are very abundant and you can use Visual Studio to develop a C# console application that can execute in Linux.
Tuhin PaulPosted Mar 17, 2024, 6:31 PM
Here are example code snippets for the two approaches mentioned previously to run your C# console application every hour:
1. Deploying to a Cloud Server (using Azure App Service as an example):
C# Console Application: (This is just a sample; modify it to write to your Google spreadsheet)
WriteToSpreadsheetmethod every hour. Azure App Service provides built-in scheduling functionalities using WebJobs or Azure Functions. You can refer to Azure documentation for detailed instructions: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timerTuhin PaulPosted Mar 17, 2024, 6:30 PM
Task Scheduler won't run your console application if the computer is shut down. Upload your C# application and configure the server environment (usually through a web interface or command line tools) to schedule its execution. Most cloud providers offer built-in scheduling functionalities or allow integration with third-party schedulers like Cron