how to perform background jobs in azure - azure

I am new to azure.
I want to run some background process on schedule interval in azure.
for example i have sample web app that send test mail.how can I runthat on every 10 minutes in azure.
i read about webjobs and how can i schedule them. I tried also creating aconsole app and uploading .exe. it runs but gets filed.
I dont know how i can upload web app also as web job same as I did for exe??
or need to opt for another option like worker role..
I m totally new to it.. so please guys suggest what would be suitable for my requirement.
I will go through it .
EDIT:
Sending mail is not my requirement. i m just doing that to check is my web job running succesfully at scheduled time interval or not.
but as i m getting unexpected response i think i should write some other code like write textfile azure storage account at every minute..
as i m totaly new.. dont have any idea about that ..anyone can share me any good link or sample demo if you can.please.

Here are two ways to develop a web job.
First
Upload a zip file that contains your executable or script file as well as any supporting files needed to run the program or script. The supported executable or script file types are listed as below.
For example, if you want to use a console application as the web job, we can go to the [ApplicationSolutionFolder/bin] and compress the Release or Debug folder as an zip file(It's better to use Release folder), then upload this zip file to azure as the web job.
Second:
We can develop it via Visual Studio: Deploy a WebJobs project
Update:
As you want to run every 10 minutes, we can set the triggers as scheduled and set the CRON expressions as [0 */10 * * * *] when we upload our zip file.
More information about CRON expressions, we can refer to: CRON expressions

Related

How to generate .sas in SAS data Integration Studio

Since i want to schedule a job in SAS-DIS. i tried the process using sas management console,but an error is popping up saying scheluing server not found. and scheduling server is an extra package that has to be purchased.
and because of that i need running on crontab on linux.
Do i need to export my job in SAS Data Integration Studio into format .sas or i can execute using .spk file format ?
if yes, i need to generate into .sas format . Please tell me how to generate that format. since i can't convert it ? Thank you.
A ´*.pkg ´ file contains much more information than your SAS code. It also contians information on the transformation and option you used as well as the graphical layout of your job.
A simple way to grab your SAS code is to open the properties of your job and select the tab with the code. However, that is not the way you should do it to schedule your job.
What you should do, is to create a "Deployed Job" object from your job. This has the advantage that your successor, or you when you come back to the project in a year, kan find out where you deployed the code today.

How to speed up slow Azure App Service Zip Deployment?

I am deploying a Nuxt application with Appveyor over Azure App Service Zip Deploy, but I am having trouble with the full deployment process being incredibly slow (Around 30+ minutes).
It seems that the whole build process is going as it should, but zipping the files takes around a minute or two (106 MB), and the file is successfully being pushed to the app service within a reasonable amount of time. However the incredible waiting time is at the Site Under Construction white page stage, taking down the whole website with it.
Does anyone have any tips to speed up this process besides upgrading
the App Service plan?
Is there any way to avoid the blank Site Under Construction page?
For example, is there a way to unzip to another folder and move the
files after everything is done so I would get minimal downtime on
the website?
You can add WEBSITE_RUN_FROM_PACKAGE=1 app settings
This option will deploy your app service to read only file system (read-only wwwroot folder, other folders are available for write operations)
Please take into account if you set this variable on ci/cd tool side probably the first time it won't apply because app settings are passed after zip deployment
And regarding the second questions. I guess it could be fixed by another app settings SCM_CREATE_APP_OFFLINE=0 (it should update your app without bringing it offline)

Make scheduled call on Azure with webjobs

I have a nodejs application deployed on Azure and I want to make a call to it let's say every friday.
Can I upload a .bat file to the webjob and tell it to call app.azurewebsites.net/test ?
Is it possible this way or is it more complex than this?
Thank you,
Mihai Dobrescu
Update:
If you just want to call the website from webjobs, it's possible. Otherwise, you can ignore my answer.
I'm not familiar with .bat, here is an link Azure WebJob calling a Web Page using Powershell. You can modify to .bat in the same way.
Please correct me if I misunderstand you.
If you just want to call the site url deployed in azure every Friday, you can just write some code to call the website(.bat / powershell / .net etc.) as webjobs, then set the schedule as per the Cron Expression(the site is broken now, please refer to this one).
If call every Friday at 9:00, the schedule like below:
0 0 9 * * Fri
When it comes to Azure WebJobs, it is actually a background app. It is not supposed to accept an incoming request just like that. However, it makes sense to post some data to a Azure queue/table record and have the WebJob or anything else read it to take suitable action. If you explain in more detail, I can help more.
Not to complicate stuff, but Azure functions also help a lot in scenarios like these.

PowerShell Script in TFS Build not uploading to Azure

After searching on Google, I've managed to put together a powershell script based on this site to upload my azure project. When I try to add it to TFS build process using the steps on the same site I get the following output:
My build says it's been running for 7 hours and if I login to windows azure there is no mention of the package. I have run it numerous other times since but not for as long, even after 10 minutes it still hasn't changed anything on the Azure dashboard.
If I run the same command from a command prompt on the build server then it runs and uploads the staging environment and it takes about 8-10 minutes to complete. Is there anything special I have to do to get it to run from TFS Build, or is there a way that I can get more meaningful output?
Finally found it. The default.publishsettings didn't have permission for the build service to read it. Added full permissions for the service and it now works.

MSDeploy not able to delete files

I've got a TFS build set up to build and deploy a web application. I'm passing in the MSDeploy parameters via the TFS build definition's MSBuild arguments. First time round this is working fine. When someone accesses the web app, one of the controls (Microsoft charting control) generates a couple of files in an empty directory I've added to the solution.
When I go to rebuild (or continuous integration is triggered) the next build will usually fail because it can't delete one of the generated files. When I try and manually delete the file it tells me that IIS worker process is using it and it can't be deleted.
Now to get the build building I'd have to manually restart IIS every time, which is not desirable with CI in mind. I've taken a look through Microsoft.Web.Publishing.Tasks.dll and there's nothing there to restart IIS using MSDeploy.
At the moment I'm thinking that adding stubs of the temporary files in the solution might be a resolution (maybe MSDeploy will be able to close the process if the file is a permanent part of the deployment) or I could do some unpleasantness with Exec in the solution file to get an IIS reset.
It's probably a long shot but has anyone come up against this and found a nice solution?
You could use MSBuild Extension Pack to stop the application pool automatically before deployment. There are several tasks in the MSBuild.ExtensionPack.Web namespace to manage IIS, such as stopping and starting an application pool, deleting an application, etc.

Resources