Deploying your MVC app and Monitoring Requests on IIS
Posted by: Suprotim Agarwal
in Category ASP.NET MVC
Abstract: A quick refresher of how to deploy ASP.NET MVC sites to IIS using Web Deployment Wizard and use the IIS request monitoring tool to nail down slow requests
IIS has built in monitoring tools that can be leveraged to monitor site performance and bottlenecks. Today we’ll deploy our code sample from the Async Await article I wrote some time back and see what kind of performance characteristics we can extract out of it.
Deploy an ASP.NET MVC App to IIS
Step 1: To get started, first thing we have to do is start Visual Studio in Administrator Mode.
Step 2: Now from the Solution Explorer right click and select “Publish Web Site”
Step 3: Select New Profile and give a name
Step 4: Next setup the Publish Method as Web Deploy, provide the server name, this can be a non-development system also; the Site Name, whether it’s the root site or a sub-site of the root site. Click Validate connection to validate.
The next two steps are optional and you can hit Publish here itself. But let’s walk through the steps.
Step 5: Here I have unchecked the ‘User this connection string…” checkbox. This runs an additional transform apart from the default deployment transform that is executed on web.config, web.debug.config etc.
Click next or Publish from here.
Step 6: If you click next, you get an opportunity to see the changes being deployed. For first deployment it’s everything, thereafter only the changes are deployed.
Once you hit Publish, monitor the Output Window till the Build Succeeded and Publish Succeeded messages appear.
Monitoring Long Running Requests with IIS
To monitor requests on IIS, start the IIS Manager. From the Run dialog you can type in inetmgr to launch it. Once up, select the root node of the Connection tree on the left and check if you have ‘Worker Processes’ under IIS installed
If not, use the Web Platform Installer to install it. Once installed, double click on it to go to Worker Processes frame.
Select the ‘View Current Requests’ link on the right or double click the correct application pool in the middle. Navigate to the main application and watch the Requests grow. If you take a closer look, this is a first time load of jQuery, MiniProfiler and Modernizer libraries are loading, hence the issue.
Once the load is complete, refresh the browser, nothing is visible in Requests list because nothing is taking as much time anymore. To test again, reset IIS, reload browser and navigate again. Conversely, you can start load the website with one of the load testing tools around stressing out the APIs to check which one is a bottle neck on load.
We had a quick refresher of how to deploy to IIS using Web Deployment Wizard. Thereafter we saw how (to obtain and) use the IIS request monitoring tool to nail down slow requests. That’s a wrap for the day, we’ll investigate more administration tools in the coming days.