UseWsFederationAuthentication - AuthenticationException: The remote certificate is invalid according to the validation procedure
<p>I am getting an error every time I try to run my MVC project on my development box through VS2015 and IIS Express.  It uses this code to authenticate against our ADFS server.</p>
<pre><code>app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
            app.UseCookieAuthentication(new CookieAuthenticationOptions());

            app.UseWsFederationAuthentication(
                new WsFederationAuthenticationOptions
                {
                    Wtrealm = realm,
                    MetadataAddress = adfsMetadata
                });
</code></pre>
<p>This is the error I am getting in the browser.</p>
<blockquote>
<p>[AuthenticationException: The remote certificate is invalid according
to the validation procedure.]<br />
System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) +231<br />
System.Net.PooledStream.EndWrite(IAsyncResult asyncResult) +15<br />
System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) +119</p>
<p>[WebException: The underlying connection was closed: Could not
establish trust relationship for the SSL/TLS secure channel.]<br />
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
+606    System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
+64</p>
<p>[HttpRequestException: An error occurred while sending the request.]<br />
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
+28    Microsoft.IdentityModel.Protocols.d__0.MoveNext()
+453</p>
<p>[IOException: Unable to get document from:
https://adfs.DOMAIN.com/FederationMetadata/2007-06/FederationMetadata.xml]
Microsoft.IdentityModel.Protocols.d__0.MoveNext()
+830    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter<code>1.GetResult() +28    Microsoft.IdentityModel.Protocols.&lt;GetAsync&gt;d__1.MoveNext() +606    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58    System.Runtime.CompilerServices.TaskAwaiter</code>1.GetResult()
+28    Microsoft.IdentityModel.Protocols.d__3.MoveNext()
+1332</p>
<p>[InvalidOperationException: IDX10803: Unable to create to obtain
configuration from:
'https://adfs.DOMAIN.com/FederationMetadata/2007-06/FederationMetadata.xml'.]
Microsoft.IdentityModel.Protocols.d__3.MoveNext()
+2226    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
+28    Microsoft.Owin.Security.WsFederation.d__c.MoveNext()
+772    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
+26    Microsoft.Owin.Security.Infrastructure.d__b.MoveNext()
+447    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
+26    Microsoft.Owin.Security.Infrastructure.d__8.MoveNext()
+440    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
+26    Microsoft.Owin.Security.Infrastructure.d__5.MoveNext()
+266    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
+26    Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +1174    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
+26    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__5.MoveNext()
+287    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
+26    Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +937    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
+26    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__5.MoveNext()
+287    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +92<br />
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +58    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
+26    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__2.MoveNext()
+272    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +26    Microsoft.Owin.Host.SystemWeb.Infrastructure.ErrorState.Rethrow() +33
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult
ar) +150<br />
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult
ar) +42<br />
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult
ar) +9791593</p>
</blockquote>
<p>It was working and now it doesn't any more....why?</p>
<p>Any thoughts on why this is not working, why the remote certificate is invalid according to the validation procedure (Where is that procedure?), and how I can get this back up and running?</p>