Forums, Documentation & Knowledge Base - ComponentSpace

SoapBinding ( Artifact response ) is throwing an exception when Sending a response


https://www.componentspace.com/forums/Topic11655.aspx

By slaneyrw - 7/19/2021

I'm using Kestrel for the hosting engine, either .NET Core 3.1 or .NET 5.0

I'm getting an exception thrown from the SendResponseAsync method n the SoapBinding when trying to send an artifact response back to the service provider.

It appears, from the stack trace, that a synchronous flush is being used to write the response.  The problem is that SynchronousIO is disabled.

Are you calling FlushAsync, or relying on a dispose to flush the response content ?

  ---> System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.StreamWriter.Dispose(Boolean disposing)
   at System.IO.TextWriter.Dispose()
   at ComponentSpace.Saml2.Bindings.Soap.SoapBinding.SendResponseAsync(String message)
   --- End of inner exception stack trace ---
   at ComponentSpace.Saml2.Bindings.Soap.SoapBinding.SendResponseAsync(String message)
   at ComponentSpace.Saml2.SamlProvider.ProcessArtifactResolveAsync(XmlElement artifactResolveElement)
   at ComponentSpace.Saml2.SamlIdentityProvider.ResolveArtifactAsync()
By ComponentSpace - 10/14/2021

I'll see if I can reproduce the issue.

Please email [email protected] so you can receive a fix to try.