{"id":4264,"date":"2008-08-13T12:09:00","date_gmt":"2008-08-13T12:09:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2008\/08\/13\/debugging-a-web-site-with-a-host-header\/"},"modified":"2008-08-13T12:09:00","modified_gmt":"2008-08-13T12:09:00","slug":"debugging-a-web-site-with-a-host-header","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/debugging-a-web-site-with-a-host-header\/","title":{"rendered":"Debugging A Web Site With A Host Header"},"content":{"rendered":"<p>If you have downloaded the RTM version of SP1 for Visual Studio 2008, you may get an error when trying to debug a Web Site with a host header on IIS 6 or IIS 5.1. The error message reads: <strong>&quot;Unable to start debugging on the web server. An authentication error occurred while communicating with the web server. Please see Help for assistance.&quot;<\/strong><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/ErrorMessage_2.jpg\"><img decoding=\"async\" style=\"border-top-width: 0px;border-left-width: 0px;border-bottom-width: 0px;border-right-width: 0px\" height=\"628\" alt=\"ErrorMessage\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2008\/08\/ErrorMessage_thumb.jpg\" width=\"784\" border=\"0\" \/><\/a>&#160;<\/p>\n<p>(Figure 1: Error Message when debugging a Web Site with a host header. In this case, the host header is <a href=\"http:\/\/www.test.com\/\">www.test.com<\/a>)<\/p>\n<p><strong>Scope<\/strong><\/p>\n<p>This issue only appears on Web Sites configured with a host header on machines with IIS 6 or IIS 5.1 and the RTM version of the .Net Framework 3.5 SP1.<\/p>\n<p><strong>Background<\/strong><\/p>\n<p>Lukasz Pawlowski, a program mangager on the Reporting Services team, published a great <a href=\"http:\/\/blogs.msdn.com\/lukaszp\/archive\/2008\/07\/18\/reporting-services-http-401-unauthorized-host-headers-require-your-attention.aspx\">blog<\/a> post describing the cause and explanation of the authentication error. Paraphrasing Lukasz: <\/p>\n<p>&quot;This error is caused by a security change made to the .Net Framework in SP1. The .Net Framework 3.5 SP1 now defaults to specifying the Host Name used in the request URL in an SPN in the NTLM authentication package. The NTLM authentication process includes a challenge issued by the destination computer and sent back to the client computer. When Windows receives a challenge it generated itself, authentication will fail unless the connection is a loop back connection. When a Web Site is configured with a host header, the host name is neither the machine name nor the loop back IP address nor the machine&#8217;s IP address, so Windows fails the authentication requests.&quot;<\/p>\n<p>If you are interested, Lucasz describes the issue in much more detail and provides a link to information about the attacks this change protects against. <a href=\"http:\/\/blogs.msdn.com\/lukaszp\/archive\/2008\/07\/18\/reporting-services-http-401-unauthorized-host-headers-require-your-attention.aspx\">Full Post<\/a><\/p>\n<p><strong>Work Around<\/strong><\/p>\n<p>There are two possible work-arounds. The recommended approach is to map your host header name to the loop back address in the registry. The steps are listed below. A less secure work around is to disable the loop back check, as described in <a title=\"http:\/\/support.microsoft.com\/kb\/896861\" href=\"http:\/\/support.microsoft.com\/kb\/896861\">http:\/\/support.microsoft.com\/kb\/896861<\/a>.<\/p>\n<h5>Specify host names<\/h5>\n<p> To specify the host names that are mapped to the loopback address and can connect to Web sites on your computer, follow these steps:   <\/p>\n<p>1. Click <strong>Start<\/strong>, click <strong>Run<\/strong>, type regedit, and then click <strong>OK<\/strong>.<\/p>\n<p>2. In Registry Editor, locate and then click the following registry key: <\/p>\n<p><strong>HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsaMSV1_0<\/strong><\/p>\n<p>3. Right-click <strong>MSV1_0<\/strong>, point to <strong>New<\/strong>, and then click <strong>Multi-String Value<\/strong>.<\/p>\n<p>4. Type BackConnectionHostNames, and then press ENTER.<\/p>\n<p>5. Right-click <strong>BackConnectionHostNames<\/strong>, and then click <strong>Modify<\/strong>.<\/p>\n<p>6. In the <strong>Value data<\/strong> box, type the host name or the host names for the sites that are on the local computer, and then click <strong>OK<\/strong>.<\/p>\n<p>7. Quit Registry Editor, and then restart the IISAdmin service and run IISReset.<\/p>\n<p><strong><\/strong><\/p>\n<p>&#160;<\/p>\n<p>Hope this helps you debug Web Sites configured to use host headers.<\/p>\n<p>Joe Cartano | SDET | Visual Studio Web Developer<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have downloaded the RTM version of SP1 for Visual Studio 2008, you may get an error when trying to debug a Web Site with a host header on IIS 6 or IIS 5.1. The error message reads: &quot;Unable to start debugging on the web server. An authentication error occurred while communicating with the [&hellip;]<\/p>\n","protected":false},"author":404,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[7265,31,7291,7303,147,7302,7267],"class_list":["post-4264","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-announcements","tag-asp-net","tag-joe-cartano","tag-sp1","tag-visual-studio","tag-visual-studio-2008","tag-vwd"],"acf":[],"blog_post_summary":"<p>If you have downloaded the RTM version of SP1 for Visual Studio 2008, you may get an error when trying to debug a Web Site with a host header on IIS 6 or IIS 5.1. The error message reads: &quot;Unable to start debugging on the web server. An authentication error occurred while communicating with the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/4264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/404"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=4264"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/4264\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=4264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=4264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=4264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}