[英]F# : Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead
While executing the POST or PUSH requests in Postman for the following repository ( https://github.com/websharper-samples/PeopleAPI ),在 Postman 中为以下存储库( https://github.com/websharper-samples/PeopleAPI )执行 POST 或 PUSH 请求时,
I am getting this error: System.InvalidOperationException: Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.
我收到此错误: System.InvalidOperationException: Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.
System.InvalidOperationException: Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.
Error Screenshot错误截图
How do I set AllowSynchronousIO to true in f# to execute POST or PUSH requests for an API?如何在 f# 中将 AllowSynchronousIO 设置为 true 以执行 API 的 POST 或 PUSH 请求?
Extremely late to the party.派对迟到了。 I had this problem with Giraffe F#.我对 Giraffe F# 有这个问题。 Fixed it by changing通过更改修复它
WebHostBuilder()
.UseKestrel()
.UseContentRoot(contentRoot)
.UseIISIntegration()
.UseWebRoot(webRoot)
.ConfigureAppConfiguration(Action<WebHostBuilderContext, IConfigurationBuilder> configureAppConfiguration)
.Configure(Action<IApplicationBuilder> configureApp)
.ConfigureServices(configureServices)
.ConfigureLogging(configureLogging)
.Build()
.Run()
to至
WebHostBuilder()
.UseKestrel(Action<KestrelServerOptions> configKestrel)
.UseContentRoot(contentRoot)
.UseIISIntegration()
.UseWebRoot(webRoot)
.ConfigureAppConfiguration(Action<WebHostBuilderContext, IConfigurationBuilder> configureAppConfiguration)
.Configure(Action<IApplicationBuilder> configureApp)
.ConfigureServices(configureServices)
.ConfigureLogging(configureLogging)
.Build()
.Run()
and the configKestrel
function looks like:和configKestrel
function 看起来像:
let configKestrel (opts : KestrelServerOptions) =
opts.AllowSynchronousIO <- true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.