You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tweaked your .Net6 example to zip a large collection of files instead of 2 urls (aprox 27,000 files, each 3KB in size).
It normally works however sometimes, I get the error message "Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead." This seems to happen particularly frequently when I use Postman to download the file instead of Edge.
This looks to be an issue with ZipArchive dispose and was reported here. The issue has been combined with general async support for ZipArchive here.
Is there any way around this, apart from setting Kestrel to allow synchronous operations?
The text was updated successfully, but these errors were encountered:
The only other workaround I can think of is to use a producer/consumer stream (i.e., a buffering stream that supports simultaneous reads and writes) in-between the ZipArchive stream and the ASP.NET stream.
There's no type I'm aware of that does this, but I've seen it come up so many times over the years that I'll probably just sit down and write one.
Thanks @StephenCleary
I appreciate the prompt response.
In my app, I've implemented some middleware to enable Synchronous IO for specific URIs as a workaround for now. Hopefully the async Zip support will get added to .Net and this will no longer be an issue.
I've tweaked your .Net6 example to zip a large collection of files instead of 2 urls (aprox 27,000 files, each 3KB in size).
It normally works however sometimes, I get the error message "Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead." This seems to happen particularly frequently when I use Postman to download the file instead of Edge.
This looks to be an issue with ZipArchive dispose and was reported here. The issue has been combined with general async support for ZipArchive here.
Is there any way around this, apart from setting Kestrel to allow synchronous operations?
The text was updated successfully, but these errors were encountered: