.net 6.o getting error "SamlException: Unable to write Form data to the response stream" on sending request to IDP url

0
AuthRequest.SendHttpPost(Response, idpUrl, relayState); stackstrace: SamlException: Unable to write Form data to the response stream. -->Inner Exception InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead. Stack Trace: at Microsoft.AspNetCore.Server.IIS.Core.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count) at Microsoft.AspNetCore.Server.IIS.Core.WrappingStream.Write(Byte[] buffer, Int32 offset, Int32 count) at System.IO.Stream.Write(ReadOnlySpan`1 buffer) at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at System.IO.StreamWriter.Write(String value) at c_b.c_759a07c9(Stream )
 
asked 4/1/2023 6:54:03 AM
add a comment

1 Answers

0
Hi , Put this in Startup.cs for either Kestrel or IIS: public void ConfigureServices(IServiceCollection services) { // If using Kestrel: services.Configure(options => { options.AllowSynchronousIO = true; }); // If using IIS: services.Configure(options => { options.AllowSynchronousIO = true; }); }
 
answered 5/8/2023 9:19:53 PM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged asp.net mvc net-core or ask your own question.