繁体   English   中英

F#:不允许同步操作。 调用 ReadAsync 或将 AllowSynchronousIO 设置为 true

[英]F# : Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead

在 Postman 中为以下存储库( https://github.com/websharper-samples/PeopleAPI )执行 POST 或 PUSH 请求时,

我收到此错误: 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. 错误截图

如何在 f# 中将 AllowSynchronousIO 设置为 true 以执行 API 的 POST 或 PUSH 请求?

派对迟到了。 我对 Giraffe F# 有这个问题。 通过更改修复它

WebHostBuilder()
    .UseKestrel()
    .UseContentRoot(contentRoot)
    .UseIISIntegration()
    .UseWebRoot(webRoot)
    .ConfigureAppConfiguration(Action<WebHostBuilderContext, IConfigurationBuilder> configureAppConfiguration)
    .Configure(Action<IApplicationBuilder> configureApp)
    .ConfigureServices(configureServices)
    .ConfigureLogging(configureLogging)
    .Build()
    .Run()

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()

configKestrel function 看起来像:

let configKestrel (opts : KestrelServerOptions) =
    opts.AllowSynchronousIO <- true

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM