{"id":1251,"date":"2014-07-14T16:18:56","date_gmt":"2014-07-14T15:18:56","guid":{"rendered":"http:\/\/blog.repsaj.nl\/?p=1251"},"modified":"2014-07-14T16:18:56","modified_gmt":"2014-07-14T15:18:56","slug":"sp2013-sharepoint-adfs-and-404-on-_trustdefault-aspx","status":"publish","type":"post","link":"http:\/\/blog.repsaj.nl\/index.php\/2014\/07\/sp2013-sharepoint-adfs-and-404-on-_trustdefault-aspx\/","title":{"rendered":"[SP2013] SharePoint, ADFS and 404 on \/_trust\/default.aspx"},"content":{"rendered":"<p>Those of you who know SharePoint, probably also know those annoying problems you just cannot get your head around. Well today I had one of those problems.<\/p>\n<h3><!--more-->Introduction<\/h3>\n<p>I was in the process of configuring ADFS for SharePoint. I&#8217;m not going to go into too much detail here because that process is well documented on its own. But following all\u00a0the steps, I was left with a non-working authentication scheme.<\/p>\n<h3>The symptoms<\/h3>\n<p>When I opened up SharePoint, I got to the &#8220;Sign In&#8221; page. That page allows you to select the login provider you want to use. After configuring ADFS, it will list Windows and ADFS (provided you had Windows \/ NTLM authentication beforehand). I selected the ADFS option and then &#8211; after a refresh &#8211; got the same page again. Huh?<\/p>\n<p>So I\u00a0checked with Fiddler and found the following course of events:<\/p>\n<pre class=\"prettyprint\">302 POST \/_login\/default.aspx?ReturnUrl=\/_layouts\/15\/Authenticate.aspx?Source=%2F&amp;Source=\/\r\n404 GET \/_trust\/default.aspx?trust=ADFS&amp;ReturnUrl=\/_layouts\/15\/Authenticate.aspx?Source=%2F&amp;Source=\/ HTTP\/1.1\r\n302 GET \/Pages\/PageNotFoundError.aspx?requestUrl=https:\/\/portal.contoso.com\/_trust\/default.aspx HTTP\/1.1\r\n302 GET \/_layouts\/15\/Authenticate.aspx?Source=\/Pages\/PageNotFoundError.aspx?requestUrl=https:\/\/portal.contoso.com\/_trust\/default.aspx HTTP\/1.1\r\n200 GET \/_login\/default.aspx?ReturnUrl=\/_layouts\/15\/Authenticate.aspx?Source=%2FPages%2FPageNotFoundError%2Easpx%3FrequestUrl%3Dhttps%3A%2F%2Fportal%2Econtoso%2Ecom%2F%5Ftrust%2Fdefault%2Easpx&amp;Source=\/Pages\/PageNotFoundError.aspx?requestUrl=https:\/\/portal.contoso.com\/_trust\/default.aspx HTTP\/1.1 \r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>There are two important things to notice here:<\/p>\n<ol>\n<li>There is no call to ADFS whatsoever, all URL&#8217;s pointed towards SharePoint<\/li>\n<li>Line 2 shows a 404 error on the \/_trust URL<\/li>\n<\/ol>\n<h3>Finding the problem<\/h3>\n<p>I did several things trying to find out what was going wrong. First I checked the ULS logs, which didn&#8217;t reveal anything out of the ordinary. Then the IIS logs, same thing. The logging was consistent with what was happening. Then I double checked all of my configuration, which all seemed to be fine. So what the hell was wrong then?<\/p>\n<p>The 404 indicates a page not found of course. Initially I thought SharePoint was throwing this error because of a fault in the configuration or something. I had checked quickly to see if the \/_trust\u00a0folder was on disk, which is was. For reference, that folder should be in your virtual directory path of IIS.<\/p>\n<h3>What the problem was<\/h3>\n<p>I mentioned I had checked quickly, and that was why I\u00a0initially didn&#8217;t see the issue. I had two IIS web sites running for this web application; one for port 80 and one SSL secured one on port 443. Check out the folder view of both:<\/p>\n<p><a href=\"http:\/\/blog.repsaj.nl\/wp-content\/uploads\/2014\/07\/adfsissue_folders.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1252\" src=\"http:\/\/blog.repsaj.nl\/wp-content\/uploads\/2014\/07\/adfsissue_folders.png\" alt=\"adfsissue_folders\" width=\"267\" height=\"545\" \/><\/a><\/p>\n<p>Notice that the first one (port 80) has the _trust folder, but the second one (443) didn&#8217;t! So that 404 error was a pretty accurate one. But why the hell would that folder be missing? I honestly have no clue.<\/p>\n<h3>What I did to fix it<\/h3>\n<p>So how do you fix a missing virtual folder in IIS? I first tried\u00a0running the configuration\u00a0wizard again, which usually reprovisions some stuff, that didn&#8217;t helpt.\u00a0I then tried stopping and starting the &#8220;SharePoint Web Applications&#8221; service, which basically does a reprovision of everything in IIS. I\u00a0made sure everything was deleted and then recreated, but weirdly that did not fix it either. So I ended up with removing the web site complete from within Central Administration and then recreating it.<\/p>\n<p><a href=\"http:\/\/blog.repsaj.nl\/wp-content\/uploads\/2014\/07\/adfsissue_remove.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1253\" src=\"http:\/\/blog.repsaj.nl\/wp-content\/uploads\/2014\/07\/adfsissue_remove.png\" alt=\"adfsissue_remove\" width=\"641\" height=\"342\" srcset=\"http:\/\/blog.repsaj.nl\/wp-content\/uploads\/2014\/07\/adfsissue_remove.png 641w, http:\/\/blog.repsaj.nl\/wp-content\/uploads\/2014\/07\/adfsissue_remove-300x160.png 300w, http:\/\/blog.repsaj.nl\/wp-content\/uploads\/2014\/07\/adfsissue_remove-624x332.png 624w\" sizes=\"(max-width: 641px) 100vw, 641px\" \/><\/a><\/p>\n<p>And there it was! The \/_trust folder appeared in IIS and all of my problems melted like snow before the summer sun. I still don&#8217;t exactly know why this went wrong, but at least the above is quite an easy fix for when it does go wrong.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Those of you who know SharePoint, probably also know those annoying problems you just cannot get your head around. Well today I had one of those problems.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[34],"tags":[87,7,39],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3KFR1-kb","_links":{"self":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts\/1251"}],"collection":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/comments?post=1251"}],"version-history":[{"count":0,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts\/1251\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/media?parent=1251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/categories?post=1251"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/tags?post=1251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}