Often, I need to restart an ASP.NET web site. There are many reasons but the most common reason (for me) is that I have updated a page and ASP.NET is displaying a cached version of that page, which does not reflect my changes.
There are multiple ways to restart an ASP.NET site; but, I always found it easiest to copy any file into the site's "bin" folder. In fact, I typically keep an empty text file named "_a.txt" in my local Documents folder for just this purpose. It is a bit of a hassle to open my FTP client (I use Filezilla), just to copy 1 file; so I recently decided to automate this process.
The Windows command prompt has an "FTP" command that that takes a "-s" argument with which you can provide a file containing FTP commands.
So I created the following text file named "RestartBlog.ftp"
In my file, I replaced blahblahblah.ftp.azurewebsites.windows.net with the FTP Host Name of my site, myusername with the FTP User Name of my site, and mypassword with the password associated with that username.
This opens a connection to my FTP site, logsin in and copies a local file named "_a.txt" to the site's bin folder. It's possible that your site's "bin" folder is in a different path, so you may need to change this. Next, it closes the connection and exits FTP mode.
After saving this file, I created another file in the same folder containing the following text:
This creates a small text file named "_a.txt"; then calls my file with FTP commands. After executing the FTP commands, this batch deletes the text file it created.
I added the "pause" at the end so that the command window would not immediately close and I could view the results and any errors that occurred. This is optional.
While building these scripts, I found this FTP Comand reference very useful: http://www.nsftools.com/tips/MSFTP.htm.
Now, I have a shortuct on my start menu that I can click whenver I want to quickly restart my ASP.NET web site.