Setup
- Install and Configure CSharpGuitarBugs on an IIS server as described in Lab 1
- Review one of the first articles I wrote at Microsoft here
Lab – Taking/Recover a Backup
- Open a command prompt as an Administrator, navigate to C:\windows\system32\inetsrv and enter the following command
Figure 1, Using AppCmd
- Review the contents of the backup
Figure 2, Using AppCmd
- Open the c:\windows\system32\inetsrv\config\applicationHost.config file and make a breaking change, like deleting a large portion of the file and saving it.
- Attempt to open IIS or a browser pointing to http : //localhost and you should get some error messages
- Restore the backup and correct the breaking change
Figure 3, Using AppCmd
Lab – Monitoring/Administering IIS
- Open a command prompt, navigate to c:\windows\system32\inetsrv and enter AppCmd /? – This provides a list of objects and syntax of the tool. Review them.
Figure 4, Using AppCmd
- Access a few of the website on the IIS server so that the worker processes are initialized.
- Execute: AppCmd wp /? to get the syntax for listing the active worker processes.
Figure 5, Using AppCmd
- Enter the command to list the active worker processes, notice that the PID is also provided. This piece of information is required to take a memory dump using, for example ProcDump.
Figure 6, Using AppCmd
- Execute: AppCmd Site /? to get the syntax for listing the sites on the web server.
Figure 7, Using AppCmd
- Enter the command to list the sites, notice that the bindings and ID are also listed. Did you know that when you have a multi-tenant environment and you want to look at the IIS log files for a specific website, the ID is the number which is at the end of the W3SVC* directory.
Figure 8, Using AppCmd
Figure 9, Using AppCmd
- Next, make a request to the View By Manufacturer link within the CSharpGuitarBugs web site, while the request is running execute the following command: AppCmd list request
Figure 10, Using AppCmd
- What information in the result of the previous command do you find useful?
- Execute: AppCmd stop appPool “CSharpGuitarBugs” to stop the worker process and AppCmd start appPool “CSharpGuitarBugs” to start the application pool again.
Figure 11, Using AppCmd
Figure 12, Using AppCmd
Figure 13, Using AppCmd
Lab – Making changes to the configuration
There are a lot of ways to make configuration to IIS, PowerShell, AppCmd, IIS Management Console, Configuration Editor, etc…, pick your tool and master it, there are better tools than other… Notepad is not a good idea…
- In the IIS Management console, click on the CSharpGuitarBugs website and open the Authentication feature.
Figure 14, Using AppCmd
- Disable Anonymous Authentication using AppCmd by executing the following command: (check out step 6 for a tip on how to get the command)
Figure 15, Using AppCmd
- Refresh the Authentication feature in the IIS Management console and you will see it was indeed set to Disabled.
Figure 16, Using AppCmd
- You can achieve the same using Configuration Manager… With the CSharpGuitarBugs website selected, click on the Configuration Editor feature and navigate to the system.webServer/security/authentication/anonymousAuthentication property.
- Set the enabled attribute to True
Figure 17, Using AppCmd
- Before you Apply the changes, click on the Generate Script link, notice that you get the C#, JavaScript, PowerShell (IIS 8+) and AppCmd statements for the change you just implemented.
Figure 18, Using AppCmd
Lab – IIS Management Console Worker Process Management
You can also see similar information from with the IIS Management Console by clicking on Worker Process feature.
Figure 19, Install
This will provide a list of all active worker process. Also notice the CPU % and Memory allocation per worker process, this is valuable information for benchmarking, right, why?
Figure 20, Using AppCmd
- Access the View by Manufacturer page in the CSharpGuitarBugs website, and notice the ‘real-time’ change in the feature.
Figure 21, Using AppCmd
- It would be nice to see which requests are being executed that are consuming the 17% of CPU. Access the View by Manufacturer page again, then double-click on the CSharpGuitarBugs Application Pool Name.
Figure 22, Using AppCmd
- This is some good information…why is this valuable information and what is it useful for?