There are many reasons you might want to warm-up a web application occasionally. It can be after a fresh deployment or on a regular basis after recycling application pools. Some times you might also need to warm-up SOAP services without going through front-end.
It might seems to be any easy task specially if you have PowerShell 3.0 or higher on your servers, but after Googling a while and reviewing some of the top hits I discovered that each solution is missing a part. Some only work in a single server scenario and some has forgotten that each HTTP response might contain links to scripts and images that we need to download and finally I could not find anything for SOAP services that just works. Long story short I decided to put together a simple script that just works and is easy to change to everyone’s needs.
Please note that my only assumption is you have PowerShell 3.0+ in your servers.
Currently the script takes care of the following tasks, but I will most likely improve it to cover other useful scenarios.
- Calling SOAP operations and sending parameters and custom headers
- Calling front-end URIs and downloading scripts and images that are local to the front-end
- Logging to a configurable folder and file name
- Cleaning up old log files
Currently, I have the following points in mind to improve the script.
- Put configuration in a different file.
- Improve function definitions (named and typed parameters and description).
- Default values for parameters when it makes sense (e.g. log folder can be the current folder).
- Support REST services.
I’m open to any suggestion and feature request. Please let me know if you found it useful or if have got something wrong.
Since I have answered this question a few times now I decided to write a post about it. maybe it helps some others who have the same question: “What is the difference between MEX and WSDL as a meta-data description for WCF service” and probably the next question: “When we should prefer one to the other?”
MEX and WSDL are both ways of publishing meta-data information from your services. WSDL is more known since it’s been around for more time than MEX. It is currently in use with a lot of web services in real world. Since they both are automatically generated for your service based on the same meta-data there is no important regarding the completeness and consistency. In short: They are the same! The only differences are as follows:
- WSDL exposes this information as a WSDL document which is accessible by an HTTP GET request (and you can easily check it in a browser) but MEX exposes the same information as a SOAP message over http, tcp and named pipes
- MEX generates one message containing all the meta-data but WSDL generate one that contains a description of Operations and one for each data contract and the URL for those are also included in the root document. In other words, MEX generates a big message containing all the required information which requires only one request to the server and WSDL generates a smaller one which contains URLs for the more detailed information that requires more requests to the server (if required)
- They are slightly different in using XML to provide information
Now that the first question is answered, answering the second one is easier:
If you are using Visual Studio as your IDE for development it can generate proxy client classes for both and if you are using svcutil.exe to generate them it can also generate them so the answer lies in the slight differences. You better use WSDL since it is easier to check in a simple web browser and only use MEX for when you need to publish meta-data through tcp and named pipes channels or for you software there is a benefit that the whole meta-data is read only once.