Scheduling a dynamic asp.net function? - asp.net

My web application is an SMS service that sends out SMS messages using an external library.
I would like to know if I can send a specific asp function using any scheduler method for asp.net?
Example would be like the web user is able to schedule a specific message to be sent everyday.
What I've found is mostly for scheduling specific webpages to run or process which is different.

To start:
Quartz.NET - Enterprise Job Scheduler for .NET Platform
Quartz.NET is a full-featured, open
source job scheduling system that can
be used from smallest apps to large
scale enterprise systems.
Combine Web and Windows Services to Run Your ASP.NET Code at Scheduled Intervals

Related

SignalR performance counters in Azure Web App

I've been trying to load test SignalR on my Azure Web App service (E.g. how many connections it can handle before subscribe calls to the hub start failing). I found that SignalR perfomance counters (https://www.asp.net/signalr/overview/performance/signalr-performance ) can provide me such info. However, I cannot install those performance counters on Web App service, buy running
SignalR.exe ipc
Is there a way to install those performance counters on WebApp or retrieve them somehow from code?
Performance Counters can't be installed on Azure Web App, as it is provided as a managed container and not a full fledged IIS on which you can do everything.
To be able to use these performance counters you can redeploy your solution on an Azure VM or to a Cloud Service, keeping in mind you will loose the flexibility that Azure Web App offers.
You can expose the SignalR performance counters in an Azure Web App using a WebRole, as stated in this article

Send SignalR notification from other process

I have an architectural question with signalR
Let's say I have a web app (pure front JS) that use a web api and the web app query an API that do a long task and want to be notified when the task is finished.
So the web api create a fire and forget task, and we use SSE with signalR to notify the web app. It's working. Great, thanks to signalR.
But now, I want the long task to be run in another process, let's say with a msmq based system.
So, the web app query the API, the web api create a message, and the msmq service process the message asynchronously.
Can the msmq service hosted in another process (maybe another machine !) notify the web app that the task is finished ? It can be possible to put the connection id in the message, but the service can be able to send the notification ?
I would use a servicebus, you can then use this library to forward the message directly to the clients.
https://github.com/AndersMalmgren/SignalR.EventAggregatorProxy

Real-time .NET app monitoring without client polling

We're building a real-time Web-based monitoring system for .NET applications (ASP.NET and Windows executable). Those applications can start a long-running operations and statistics are displayed in real-time on Web page.
For ASP.NET ones we found SignalR a perfect solution: Long running operation (even caused by simple WebForms form postback) periodically call JS client-side functions via SignalR RPC to update monitoring page. But we hit 2 caveats:
In ASP.NET we need to monitor several different apps located in several different virtual directories. How do we push data from those different apps onto a single HTML monitoring page?
Another app is a .NET Windows console executable that runs periodically on a schedule. How do we push its run-time statistics to the same monitoring HTML page? One thing comes to mind - have EXE store temporary statistics in a DB and have client pull same data from the DB, but we'd like to avoid polling. Another - periodically at a given intervals the EXE would call the WebApp, passing the data - and WebApp would pass it to client via the same SignalR call. But are there better ways?
One architecture that I've used is a small monitoring collection service, with embedded monitoring clients in every monitored application, Asp.net, Windows desktop app, console app, Windows service, or otherwise.
The collection service is always running. A webapp then connects directly to the service and requests the state of all monitored apps.
Monitored apps run some small embedded client that feeds back application-specific metrics to the monitoring service. The client can either provide data on events or timers, or the monitoring service an ask for it on a timer itself.
With this, we have a unified monitoring architecture - everything that runs just talks to the monitoring service to send updates, and the health viewer clients just ask the service for data using a unified protocol.
It's basically the Application Server pattern applied to monitoring, and takes a couple cues from the design of SNMP.
Very new to SignalR, didn't realize it has multiple clients for different platforms. We will go with SignalR .NET client for all the apps - they will all talk to main SignalR hub directly invoking server-side methods, which in turn update monitoring page.

Is message queueing mandatory for Azure web app when sending emails through SendGrid

I have an Azure web application (Asp.net MVC & WebAPI) that sends emails through SendGrid service. I'm not using SendGrid's API but rather use .net built-in SMTP that I configured in web.config and directed to SendGrid.
I'm now wondering whether I also need message queueing application in my solution that would be used to actually send emails to SendGrid to minimize request/response times of my web app?
Azure already has Queue Storage that I could use but I wonder how others have implemented this? I'm also looking for the most simple example of Azure web app using queueing if one exists.
I expect message queueing will become relevant when I'll have several emails to send during single request to make my app scalable. Currently I'm sending email synchronously when my backend executes code and so far with the low number of emails it works fine.
If your application need to manage and send bulk emails asynchronously, it would be better to have separate application which will take emails as bulk.
In my recent project, I have created separate application using web role, worker role and a service bus queue. Web role is a web API which used for application to post bulk emails and put it into a service bus queue. Then worker role will be responsible for dealing with the queues and send the emails. This allowed me to send emails asynchronously and storing any email messages or message status in a table storage.
Further, this approach helps me to use same notification application (email sending application) in different projects by using a wrapper to handle web api integration.

Execute Web Jobs from ASP.Net MVC

I have c# console application which is using for some long running task. In my local system I am executing it from ASP.Net MVC 5 controller by System.Diagnostics.Process class. Now we are going it to implement it into azure as our site is deployed in azure in development mode.
I am new to azure so don't how to do it.However study several article I have found that I can upload my console application as web jobs. I can run web jobs as trigger i.e. ondemand.
But now my question is how can execute this web job from MVC controller as I need to pass some argument from controller?
Currently there is no direct link between WebSite and WebJob, even though they are executed in the same application pool. And the best way would be to post a message to a queue from you MVC app. And on the other end have your WebJob to check for the queue for new messages. Just like Andres already said.
This will not be instant, but easy to implement and cheap.
If you need instant reaction from your console app, you'll need to implement your background tasks as Worker Roles and deploy as a separate VMs, and have there some sort of network communication going on, so you can always reach out for your worker role via TCP.
You can set up your web site to push an item to an Azure Queue, and then have your web job be triggered every time an item is pushed to the queue.
There is some information, including code samples for how to do that on http://www.asp.net/aspnet/overview/developing-apps-with-windows-azure/getting-started-with-windows-azure-webjobs.

Resources