嗯,在使用 asp.net core 中遇到這么一個異常:
Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead
解決方法,加入配置:
public void ConfigureServices(IServiceCollection services) { // If using Kestrel: services.Configure<KestrelServerOptions>(options => { options.AllowSynchronousIO = true; }); // If using IIS: services.Configure<IISServerOptions>(options => { options.AllowSynchronousIO = true; }); }