Run aspx file every hour - asp.net

I have an aspx file on my windows 2012 server, I've come from Linux servers so i'm used to cron jobs. I googled and found a lot of talk of using the Task Scheduler, but all the documentation is on Microsoft's site and is completely impossible to understand for anyone that doesn't have a PhD in English.
Can anybody that has experience help me out?

I don't know if it's possible for you to do or not, but if you take the logic from your aspx page and turn it into a Web Service, you can create a simple console application (.exe) that executes your Web Service code. The task scheduler would call the executable instead of opening a browser.

Related

Triggering Automation Test Scripts of Remote Machine from ASP.NET Page

In our project, we need to meet one Requirement.
"Triggering automation test scripts which are located remotely from asp.net web page"
We are developing a DashBoard for our Testing Team. They want to trigger their test scripts from the webpage.
I have been googling since 3 days, to find the approaches to meet the requirement. And to know whether its possible or not.
Please kindly share your ideas.
You need to provide access to the scripts for your webserver in order to hit them.
The first step is to provide remote access to your visual basic scripts. I would do this by writing a small application to provide a RESTful endpoint that your webserver can then hit. Another option is a shell script on your web server that SSH connects to the remote machine and runs the scripts provided. You could then call the the shell script with your ASP.NET application.
You need to start by thinking about how to expose your VB scripts to the internet. Once you have that answer, running them from your webserver is easier.

Easier way? Azure Websites, Application logging asp.net

When I get a call there was an error in our web application when running on a windows server I would simply go to Windows Logs and scroll down the application logs and find the Warning. Easy to read and made it quick to solve the problem.
Now I'm testing out Azure Websites to run asp.net applications and i'm racking my brain trying to figure out how to have the same kind of quick error find a fix process.
Viewing the application logging in Azure's application diagnostics is utterly useless.
It would take me forever to dig through those logs. rewriting the application to handle errors differently is not an option for me.
So who else is having this problem? any solutions?
The easiest solution is to offload your error logs to a separate service like Raygun. This will result in a (small) monthly fee but is a 5 minute setup and you are good to go.
Otherwise you can go and use Log4net to log your error to the blob storage but then you will have to poll that one for your logs.
Try the Azure Website Log Browser site extension, you can install it from the new Azure Portal on your website (as a site extension) and it makes it easier to view all of your logs.
Read more about it here.

Shell.Invoke doesn't launch the powershell script in deployed asp.net web application

I wrote an asp.net web application, which launches a powershell script. The program ran without any issue when I debugged it in my development environment. After publishing and deploying the asp.net web application (by the way the target server is the same machine localhost), by clicking the button for launching the powershell script, nothing happened. It means the powershell script was not launched. I attached the debugger to the deployed asp.net and saw that the Shell.Invoke() was hit as before and the command was also correct. However Shell.Invoke() returned immediately and the powershell script was not launched. In my environment the powershell execution policy is RemoteSigned.
Since the program in the development environment works perfectly and in the deployed case also hits the same code, I don't think it has to do with the code but more with security, certification,...???
Has anyone experienced the same? If yes, please advise me what I should do.
I appreciate your help in advance.
Thx
Might have something to do with the application pool identity not having the right permissions:
You might want to run your PowerShell invocation from a system service with explicit permissions though. That will take a steeper curve though.

Hosting an ongoing process in IIS

Is there a way to host an ongoing process in IIS? Let's say i'm writing an invoicing web site and every so often I need to send out scheduled invoices. This is really part of my invoicing app and I'd like it to be deployed as part of my invoicing app, by copying files to the web server. I don't want the deployment headaches or the awkward separation that would come with writing this as a Windows Service. Is there a way this can be done in IIS?
Probably your simplest solution would be to develop a simple console EXE that does its thing and you schedule it in Scheduled Tasks. Updates to the EXE are done the same way as the web app, just overwrite the file.
Take a look Best way to run scheduled tasks, it'd probably fit your use case.

Can Classic ASP pages run in Azure?

I'm looking into Azure and unsure if Classic ASP (i.e. ASP 3.0 with .ASP extensions) can run in Azure?
I found this blog post from January 2009 indicating Classic ASP can NOT be run in Azure. But on this interoperability page it looks like now, other platforms like PHP can be run on Azure. I still see no mention of Classic ASP though.
Can Classic ASP pages run in Azure?
Check this out - http://channel9.msdn.com/Shows/Cloud+Cover/Cloud-Cover-Episode-31-Startup-Tasks-Elevated-Privileges-and-Classic-ASP, at about 15 minutes in they tell you how to run Classic Asp in Azure
The actual startup command is at 23:51 within the video.
I've tried replicating the code that they have on the show but I get an error - "CloudServices64 : Cannot find file named 'approot\bin\startup.cmd'" for startup task startup.cmd when I try to build the project. Hopefully its just me and you'll have better luck.
To solve the error "CloudService...." - have a look at http://207.46.16.248/en-us/library/gg456327.aspx It tells you that you need set the properties on the file to "copy to output directory" to always
Yes, the instructions for enabling it are here:
http://coderead.wordpress.com/2011/09/20/running-classic-asp-on-azure/
Not yet, but as soon as the new "virtual machine role" becomes available, you'll be able to configure your own virtual server(s) to support classic ASP. No timeline given AFAIK, but "soon" has been mentioned.
These servers will run on the Azure hardware, but they won't run the Azure Guest OS 1.x, so you cannot easily use Azure features like Storage or AppFabric... then again, you might not want to from a classic ASP environment :-)
EDIT: at the time of asking my answer was correct (there was no full IIS available), but a lot has changed, so the answer in 2012 would definitely be "yes", as detailed below.
Nope. You can attempt to get around recoding your ASP pages with something like the ASP Classic Compiler.

Resources