Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am working on a newsletter. Newsletter content is saved in the table along with frequency such monthly, weekly, daily. Newsletter also have start date. What I have to do is based on the data and frequency. Newsletters are emailed to all the subscribers. My confusion is that whether I need to write a sql server job for this or simply asp.net can do this. If yes then how would I be able to do this.
As your web application will be terminated in times of inactivity, you usually have a service or task scheduler run such periodical tasks. Also your web application is responsible to return requests quickly and should run with a very limited set of permissions that might not be enough for your jobs (it is preferable not to allow the app pool account to send e-mails to lots of accounts).
There are various alternatives that differ in terms of convenience and deployment of your application.
An important requirement besides the capability to run jobs periodically is how you can trace errors in the job, so you should think about your logging strategy before the first problems arise.
Besides writing a SQL Server job, you could also:
Create a console application and use Windows task scheduler to run it periodically (interval is the minimum of your scheduling options, in your question daily). This is easy to implement, but requires some steps to deploy it to a computer.
Create a dedicated windows service that is installed to the computer. While this requires more effort to create and test the service, you can also create an installer to simplify the deployment.
I eventually went for the application events. I set the timer in application event and it works similar like jobs and windows services.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
There is a gazillion types of services in Azure, and I'm having a hard time to choose the correct one.
We're building a service in C# that should periodically check a DB, do some processing and then push REST data to an endpoint outside of Azure.
The service is vital, but it wont be heavy duty, most likely it will do some processing once every 15 minutes and send out some data, then it will sleep and start over again. It's going to send backend data from Azure to a third party
on premise server
That sounds simple enough and is probably doable with several types of Azure services, but I need some help to decide which one to go for.
I need some pros and cons of the different types.
Whenever I search the azure documentation most of the services are primarily for for apps/services that expose either a web page or an API, we won't use any of that.
So what Azure project type do you suggest that we choose?
I have looked at "Azure Cloud Service", "Azure Functions", "Web App" etc.
I don't think we will need a full virtual machine, this won't be processing millions of rows each second.
I think that your best approach will be a time triggered Azure Function:
[FunctionName("TimerTriggerCSharp")]
public static async void Run([TimerTrigger("0 */15 * * * *")]TimerInfo myTimer, ILogger log)
{
await ProcessDB();
await MakeRestCall();
}
Since you want to run it only every 15 minutes, this is ideal!
This will save you a buck while development and deployment is super easy.
Running other solutions (Like a web app) will require you to handle the timer and the environment yourself.
And since it will be always up, you will be paying for the whole time it is up. Even when you don't run your logic.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I want to send Email and SMS in bulk in c# MVC. So, method would be better, cron in a web application or separate scheduler service for it?
I have a web application running already. So, should I integrate the cron in the web app itself or create a new scheduler service for it.
I want to use the best method in terms of reliability, speed and load of data.
its better to make separate service for that for the below reasons :
1- Maintainability : If there is a problem in sending mails or SMS you know where you need to check without going to your main solutions.
2- Availability & Scalability : You can scale this Module only or if any thing happens to your main app, your mailing and sms will still be working.
3- Separation of Concerns : SMS and Emailing is considered to be a cross cutting functionality that it will be used in alot of places in system, so it is better to have it in one separate place.
4- I/O latency : like this you will avoid any latency or any performance effects on your main business domain.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am working on code to send an sms to customer one week before their subscription reach expiration date. I absolutely don't know how to proceed. I am coding in asp.net c# and sql server.
Create one console Application which will take user whos expiration comes in week, Then write code to fetch the user with there numbers. Then use any third party Api to send sms. you have to send parameters to this Api with your appropriate message.
Then create one job inside sql server which will run everyday which will execute your Console Application code to send SMS.
I would say, separate out publishing and subscription tasks. So in future you can do more with such customers.
Prepare a Publisher which looks for such customers and adds a task to Queue.
Write a Subscriber who watch outs for new queue items and take action.
So in future if you want to make multiple way of communicating to customer like, email then you just need to add more subscriber.
Host your logic as a .NET windows or IIS service.
Benefit: Publisher can independently perform addition.
Subscriber performs task as soon it sees something in queue.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
We have a long running report which is now scheduled using Reporting Services. This report runs around 40 minutes and produces a csv report of around 10 MB of data. We are now building a new Asp.Net MVC app and the user wants us to bring this long running report into ASP.Net MVC and retire the Reporting services. Initially we thought of doing it with Task.Run/HostingEnvironment.QueueBackgroundWorkItem but we moved away due to app domain recycle issues and we do not want our worker process to take this load.
Currently, we are planning to build a command line C# exe which can run the stored procedure and prepare the CSV report into a shared folder. We will then have a ASP.Net MVC view from where user can initiate the command line exe through system.diagnostics.process.start() method. The ASP.NET MVC will show the report as downloadable link once the process is completed. We will have a status DB table which the exe can update the status once the process completes and the Asp.Net MVC view can use this to display the status and downloadable report.
Is there a better way of handling this requirement? Thanks in advance!
Regards,
Bala
I would go for the Windows Service approach. The main reason is that you can keep an eye on how many instances are running at the same time and throttle it if you need to. You don't get the same kind of control with an exe. Use the same status approach, that will work fine.
You are right to keep this out of the Web App, you really don't want to put that kind of pressure on it. You could even run the service on a different server to keep the web one lighter.
It's a valid-enough approach, I think. However, running an EXE requires a full trust environment, which is generally not a good idea. Personally, I would use something like HangFire, instead.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have created a Windows Forms application in .NET 4.0. Now there are about 20 client machines where the application has to be reinstalled every time there is a build change.
Is there a way I can push the application to all the machines in the client network in a single go?
ClickOnce is your friend.
In short, ClickOnce allows you to publish an application to a server and users can browse to an associated installation website and install your software.
If your ClickOnce settings are set properly, each time the user launches the application, the application will check for an update on the server, download it if it exists and update then application.
It's worth noting that with each update, the entire application is re-installed. This can save you a ton of headaches but if your application is large, it could be a nightmare for your users if you update the system frequently. Hit the link provided above for all of Microsoft's information regarding this deployment mechanism.
You can have your sysadmin create a Group Policy to do this.