Lab 23: Troubleshooting 400 and 404
This article has been moved to its new home here: https://benperk.github.io/msdn/2016/2016-IISLAB-lab-23-troubleshooting-400-and-404.html
- Review the requestFiltering attribute here
- Read information about HTTP 400 – Bad Request here
- Check out the new Microsoft Message Analyzer here
- Check out Network Monitor here
- Install and Configure CSharpGuitarBugs on an IIS server as described in Lab 1
1. Access the CSharpGuitarBugs website from a client machine, not from the IIS server, click on Full Catalog – ASPX, press the Next Page button and the following error is rendered, why? Q: Does the file being requested exist? A: Yes
1. If it exists, then why are you getting a 404? 404’s have a lot of sub-status codes… Q: Where do you find the sub-status code and what is it? A: See options a. – d.
a. Access the website while on the server.
b. Look in the IIS logs
c. Failed Request Tracing logs
d. Turn on remote error rendering, by modifying the web.config file like the following
2. Access the same file from a browser while on the server and you see this error
3. To resolve this issue set allowDoubleEscaping to true
4. Refresh the website from a client machine, 404.11 is gone, continue to next lab, because now you get another error, right?
1. Access the CSharpGuitarBugs website from a client machine, not from the IIS server, click on Full Catalog – ASPX, press the Next Page button and the following error is rendered when selecting the following button, why?
2. What tools can you use to get more information from the client side? If you already configured customErrors in Lab 23-1, 1d, then you will not see the above, instead you will see the below. You can also use Fiddler or
3. Access the same from the IIS server.
4. How do you fix this? Q: Can it be fixed on the IIS side? A: No. Colons are only allowed in the query string after a ?, you cannot have one anyplace in the URL
- Make sure customErrors mode = ON, this is the most likely configuration so need to know how to troubleshoot without it
- Check out Lab 10 for a similar lab. Lab 10 also for the solution to this lab, I.e. change the MaxFieldLength and MaxRequestBytes both discussed further here
1. Access the CSharpGuitarBugs website from a client machine, not from the IIS server, click on Full Catalog – ASPX, press the Refresh button and the following error is rendered when selecting the following button, why?
2. What error do you get, how can you trouble shoot it?
a. Look in the IIS logs, what Status Code is being returned?
b. Look in the HTTP Error log, what is being returned there?
c. Try Network Monitor…
d. Try Fiddler
e. Last, set customError=Off
Take a Network Monitor Trace, reproduce the 400 and analyze it
1. Make sure customErrors mode=”Off” for the 400 web site, what happens when it is On?
2. Install Network Monitor on a remote machine, not on IIS
3. Start a Capture and reproduce the 400.
4. Stop the Capture
5. Enter HTTP into the Filter box and Apply
6. Click the process where the error was capture within
7. Find and review the error
8. Open the same in Microsoft Message Analyzer