This is a sample web application that was used in some demos to demonstrate using web deployment tool. It has the following features:
1. A simple portal for non admins (such as developers) to submit request to deploy web application packages to production
2. It creates a back up of the site or app before deploying the submitted package
3. Deploys the package using the answers file applicable to the environment (such as productionanswers.xml)
4. In case of failure, rolls back in the sense of re-deploying the backup created in the earlier step.
5. It also demonstrates logging using the API. It intercepts all log events and sends these messages to the MSMQ queue. The status page uses AJAX update panel to get the log messages and display them to the user.
You can download the solution file for Visual Studio 2010 here
SyncManager class is the wrapper for the Web Deployment API. The deploy page calls syncpackage function which queues a thread and returns immediately redirecting the user to status page. The CallMsDeployAPI does the actual work of deployment while DumpProvider gets an XML dump of any provider. To get the log message to be displayed in real time, I have added a traceeventhandler that queues the message to an MSMQ queue.
I will write more details about the functioning of this app later.