Lab 9: Using AppCmd


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

1. Open a command prompt as an Administrator, navigate to C:\windows\system32\inetsrv and enter the following command

image

2. Review the contents of the backup

image

3. 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.

4. Attempt to open IIS or a browser pointing to http://localhost and you should get some error messages

5. Restore the backup and correct the breaking change

image

Lab – Monitoring/Administering IIS

1. 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.

image

2. Access a few of the website on the IIS server so that the worker processes are initialized.

3. Execute: AppCmd wp /? to get the syntax for listing the active worker processes.

image

4. 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.

image

5. Execute: AppCmd Site /? to get the syntax for listing the sites on the web server.

image

6. 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.

image

image

7. 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

image

8. What information in the result of the previous command do you find useful?

9. Execute: AppCmd stop appPool “CSharpGuitarBugs” to stop the worker process and AppCmd start appPool “CSharpGuitarBugs” to start the application pool again.

image

image

image

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…

1. In the IIS Management console, click on the CSharpGuitarBugs website and open the Authentication feature.

image

2. Disable Anonymous Authentication using AppCmd by executing the following command: (check out step 6 for a tip on how to get the command)

image

3. Refresh the Authentication feature in the IIS Management console and you will see it was indeed set to Disabled.

image

4. 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.

5. Set the enabled attribute to True

image

6. 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.

image

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.

image

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?

image

1. Access the View by Manufacturer page in the CSharpGuitarBugs website, and notice the ‘real-time’ change in the feature.

image

2. 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.

image

3. This is some good information…why is this valuable information and what is it useful for?

Comments (0)

Skip to main content