简体   繁体   English

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

[英]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.

相关问题 Twitter流API与F#中的代理 - Twitter stream api with agents in F# 如何在F#中隐藏方法? - How can I hide methods in F#? 动态js捆绑同步api调用 - Dynamic js bundle synchronous api call F#:淡化API的最佳方法? - F#: Best way to de-fluent an API? 无法调用我的api引发错误对于需要预检的跨域请求不允许 - Not able to call my api throwing error Disallowed for cross-origin requests that require preflight 我可以使用 `request` npm 包进行同步调用吗? - Can I make synchronous call with `request` npm package? 如何在 rest api 调用中构造 json 并使其同步 - how to structure json in rest api call and make it synchronous 反序列化Twitter流json字符串F#,如何将“ null”定义为适当的值? - Deserializing twitter stream json string F#, how to define 'null' as a proper value? 反应同步 Api 调用(在 Cloudinary 图像上传调用完成后调用第二个 api) - React Synchronous Api Calls (call second api after Cloudinary image upload call finishes) 并行(同步)运行 two.network 调用并在移动到 flutter 移动设备中的下一个代码之前比较它们的结果 - Run two network call in parallel (synchronous) and get their result to compare before moving to next code in flutter mobile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM