.Net Core 3.1 Synchronous operations are disallowed Exception #534
Replies: 2 comments 2 replies
-
Setting I think the right way to handle this is to either do the compression in a background job and return a JobID that can be polled for the result or something similar. |
Beta Was this translation helpful? Give feedback.
-
AllowSynchronousIO can be enable for single calls as well. We are probably going with that as we only need the ZIP to bundle together some small files for single file download. We don't even really need compression. var syncIOFeature = HttpContext.Features.Get<IHttpBodyControlFeature>();
if (syncIOFeature != null)
{
syncIOFeature.AllowSynchronousIO = true;
} It still feels wrong somehow. |
Beta Was this translation helpful? Give feedback.
-
Steps to reproduce
Actual behavior
System.InvalidOperationException: 'Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.'
The problem seems to be that .Net 3.1 disables "synchronous operations" by default and as workaround you can set "AllowSynchronousIO" to true in startup.
However, I wonder if this should/could be fixed with a PutNextEntryAsync method.
To be honest, I don't yet understand the underlying issue completely though.
Version of SharpZipLib
1.3.0
Beta Was this translation helpful? Give feedback.
All reactions