This article is a mirror article of machine translation, please click here to jump to the original article.

View: 3679|Reply: 1

[Source] Synchronous operations are disallowed. Call WriteAsync or set AllowSync...

[Copy link]
Posted on 3/16/2023 9:09:31 PM | | | |
ASP.NET Core 3.0 project uses responsePageStream.Write to output bytes of error as follows:


InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.


Solution 1 (recommend):

Change to an asynchronous method call, the code is as follows:



Solution 2:

Globally modify the AllowSynchronousIO configuration to allow requests for synchronous IO response actions, with the following code:



Solution 3:

Local variable modification, modify the AllowSynchronousIO configuration for a single request, the code is as follows:

(End)




Previous:Chrome browser modifies the website js, css source code
Next:LIKE fuzzy queries in SQL Server do not work properly in Chinese
 Landlord| Posted on 3/16/2023 9:11:29 PM |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com