C # ping website? (save service)

Is there a way in C # to be able to ping a URL every 15 minutes and receive a response from the server?

I want to try to find out if .NET can be used to create a simple tool so that asp.net sites cause reassembly so that the first user does not execute a penalty for loading when the application starts.

or if someone has an alternative method to achieve the same goal ... thoughts? tip? ideas?

+6
c # keep-alive
source share
6 answers

Typically, the person who clicked on a release should visit after he uploaded the site only for sake verification (make sure that nothing was bombed). But if you are looking for a programmatic approach, WebClient might be useful ...

 using (WebClient client = new WebClient()) { client.DownloadString("http://wwww.sitename.com/"); } 

Then make it exe and use the window scheduler to start it. You could even put this in WinService and report the status of the log file.

Update:

It seems that VS2012 now opens the page after publication, as a result of which clicking on the site is the first request.

In addition, if you find that you have to visit it often (every 15 minutes, as mentioned in the question), you may want to reconsider the IIS / AppPool configuration and change the cycle time to something longer. IIS initially saves resources that are not used, so if the site was not requested after a while, it will actually free up memory for another application that will be used.

+9
source share
+5
source share

You can create an HttpWebRequest and use something like Quartz.NET to schedule it.

+3
source share

You can simply disable WebRequest - ping will not receive the website for recovery.

+1
source share

I installed curl and used the scheduled task to do what you want.

I combined it with powershell to restart application panels too.

+1
source share

You can NGEN your ASP.NET builds and combine this with the Hector warm-up answer .

0
source share

All Articles