IDP initiated SLO For Office365

Im trying to implement IDP initiated SLO. But im getting error’s(exceptions),
steps i have followed:
1. SP initiated SSO completed successfully for office365.
2.created a test method(API) and i have placed this method (_samlIdentityProvider.InitiateSloAsync():wink: in that API
3. calling test API from same browser.

See the below log for exception details.
depending on SLO serivce binding, Im getting different error’s. Suppose if i place SLO service binding to http-redirect, im getting different exception. if i change it to http-post im getting different exception. see below for exception details


log -----------------------------------------
2019-02-27 12:53:02.982 +05:30 [Information] ComponentSpace.Saml2, Version=2.0.6.0, Culture=neutral, PublicKeyToken=null, .NET Core build, Licensed.
2019-02-27 12:53:02.994 +05:30 [Information] CLR: .NET Core 4.6.27110.04, OS: Microsoft Windows 10.0.15063 , Culture: English (United States)
2019-02-27 12:53:51.274 +05:30 [Error] Initiation of SLO to the partner service providers has failed.
ComponentSpace.Saml2.Exceptions.SamlBindingException: Failed to send the SAML message over HTTP-Redirect. —> System.NullReferenceException: Object reference not set to an instance of an object.
at ComponentSpace.Saml2.Bindings.AspNetHttpResponse.Redirect(String url)
at ComponentSpace.Saml2.Bindings.Redirect.HttpRedirectBinding.SendMessageAsync(String url, String message, Boolean isResponse, String relayState, AsymmetricAlgorithm key, String signatureAlgorithm)
— End of inner exception stack trace —
at ComponentSpace.Saml2.Bindings.Redirect.HttpRedirectBinding.SendMessageAsync(String url, String message, Boolean isResponse, String relayState, AsymmetricAlgorithm key, String signatureAlgorithm)
at ComponentSpace.Saml2.SamlProvider.SendMessageAsync(String destinationUrl, XmlElement messageElement, Boolean isResponse, String relayState, String binding, AsymmetricAlgorithm key, String signatureAlgorithm)
at ComponentSpace.Saml2.SamlProvider.SendLogoutRequestAsync(XmlElement logoutRequestElement, String relayState)
at ComponentSpace.Saml2.SamlIdentityProvider.SendLogoutRequestToNextServiceProviderAsync(String relayState)
at ComponentSpace.Saml2.SamlIdentityProvider.InitiateSloAsync(String logoutReason, String relayState)
2019-02-27 12:54:24.518 +05:30 [Error] Initiation of SLO to the partner service providers has failed.
ComponentSpace.Saml2.Exceptions.SamlBindingException: Failed to send the SAML message over HTTP-Redirect. —> System.InvalidOperationException: StatusCode cannot be set because the response has already started.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ThrowResponseAlreadyStartedException(String value)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.set_StatusCode(Int32 value)
at Microsoft.AspNetCore.Http.Internal.DefaultHttpResponse.Redirect(String location, Boolean permanent)
at ComponentSpace.Saml2.Bindings.Redirect.HttpRedirectBinding.SendMessageAsync(String url, String message, Boolean isResponse, String relayState, AsymmetricAlgorithm key, String signatureAlgorithm)
— End of inner exception stack trace —
at ComponentSpace.Saml2.Bindings.Redirect.HttpRedirectBinding.SendMessageAsync(String url, String message, Boolean isResponse, String relayState, AsymmetricAlgorithm key, String signatureAlgorithm)
at ComponentSpace.Saml2.SamlProvider.SendMessageAsync(String destinationUrl, XmlElement messageElement, Boolean isResponse, String relayState, String binding, AsymmetricAlgorithm key, String signatureAlgorithm)
at ComponentSpace.Saml2.SamlProvider.SendLogoutRequestAsync(XmlElement logoutRequestElement, String relayState)
at ComponentSpace.Saml2.SamlIdentityProvider.SendLogoutRequestToNextServiceProviderAsync(String relayState)
at ComponentSpace.Saml2.SamlIdentityProvider.InitiateSloAsync(String logoutReason, String relayState)
2019-02-27 14:26:52.950 +05:30 [Information] ComponentSpace.Saml2, Version=2.0.6.0, Culture=neutral, PublicKeyToken=null, .NET Core build, Licensed.
2019-02-27 14:26:52.964 +05:30 [Information] CLR: .NET Core 4.6.27110.04, OS: Microsoft Windows 10.0.15063 , Culture: English (United States)
2019-02-27 14:42:20.524 +05:30 [Information] ComponentSpace.Saml2, Version=2.0.6.0, Culture=neutral, PublicKeyToken=null, .NET Core build, Licensed.
2019-02-27 14:42:20.544 +05:30 [Information] CLR: .NET Core 4.6.27110.04, OS: Microsoft Windows 10.0.15063 , Culture: English (United States)
2019-02-27 14:43:37.137 +05:30 [Error] Initiation of SLO to the partner service providers has failed.
ComponentSpace.Saml2.Exceptions.SamlBindingException: Failed to send the SAML message over HTTP-Post. —> System.NullReferenceException: Object reference not set to an instance of an object.
at ComponentSpace.Saml2.Bindings.AspNetHttpResponse.get_Body()
at ComponentSpace.Saml2.Bindings.Post.HttpPostBinding.SendMessageAsync(String url, String message, Boolean isResponse, String relayState)
— End of inner exception stack trace —
at ComponentSpace.Saml2.Bindings.Post.HttpPostBinding.SendMessageAsync(String url, String message, Boolean isResponse, String relayState)
at ComponentSpace.Saml2.SamlProvider.SendMessageAsync(String destinationUrl, XmlElement messageElement, Boolean isResponse, String relayState, String binding, AsymmetricAlgorithm key, String signatureAlgorithm)
at ComponentSpace.Saml2.SamlProvider.SendLogoutRequestAsync(XmlElement logoutRequestElement, String relayState)
at ComponentSpace.Saml2.SamlIdentityProvider.SendLogoutRequestToNextServiceProviderAsync(String relayState)
at ComponentSpace.Saml2.SamlIdentityProvider.InitiateSloAsync(String logoutReason, String relayState)
2019-02-27 14:47:02.532 +05:30 [Error] Initiation of SLO to the partner service providers has failed.
ComponentSpace.Saml2.Exceptions.SamlProtocolException: There are no partner service providers to logout.
at ComponentSpace.Saml2.SamlIdentityProvider.InitiateSloAsync(String logoutReason, String relayState)
2019-02-27 14:48:18.917 +05:30 [Error] Initiation of SLO to the partner service providers has failed.
ComponentSpace.Saml2.Exceptions.SamlBindingException: Failed to send the SAML message over HTTP-Post. —> System.ObjectDisposedException: Cannot write to the response body, the response has completed.
Object name: ‘HttpResponseStream’.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.g__ThrowObjectDisposedException|24_0()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken)
at System.IO.StreamWriter.FlushAsyncInternal(StreamWriter _this, Boolean flushStream, Boolean flushEncoder, Char[] charBuffer, Int32 charPos, Boolean haveWrittenPreamble, Encoding encoding, Encoder encoder, Byte[] byteBuffer, Stream stream, CancellationToken cancellationToken)
at System.IO.StreamWriter.WriteAsyncInternal(StreamWriter _this, String value, Char[] charBuffer, Int32 charPos, Int32 charLen, Char[] coreNewLine, Boolean autoFlush, Boolean appendNewLine)
at ComponentSpace.Saml2.Bindings.Post.HttpPostBinding.SendMessageAsync(String url, String message, Boolean isResponse, String relayState)
— End of inner exception stack trace —
at ComponentSpace.Saml2.Bindings.Post.HttpPostBinding.SendMessageAsync(String url, String message, Boolean isResponse, String relayState)
at ComponentSpace.Saml2.SamlProvider.SendMessageAsync(String destinationUrl, XmlElement messageElement, Boolean isResponse, String relayState, String binding, AsymmetricAlgorithm key, String signatureAlgorithm)
at ComponentSpace.Saml2.SamlProvider.SendLogoutRequestAsync(XmlElement logoutRequestElement, String relayState)
at ComponentSpace.Saml2.SamlIdentityProvider.SendLogoutRequestToNextServiceProviderAsync(String relayState)
at ComponentSpace.Saml2.SamlIdentityProvider.InitiateSloAsync(String logoutReason, String relayState)

Please send the complete log file as an email attachment to support@componentspace.com mentioning your forum post so we can take a closer look.

[quote]
ComponentSpace - 2/27/2019
Please send the complete log file as an email attachment to support@componentspace.com mentioning your forum post so we can take a closer look.
[/quote]

I have emailed the log file to support@componentspace.com. Please respond on this ASAP.

Thanks
kirann

Received, thanks. Will do.