gpt4 book ai didi

asp.net-core - ASP.NET Core 1.0 同步上下文

转载 作者:行者123 更新时间:2023-12-02 18:05:18 25 4
gpt4 key购买 nike

ASP.NET Core 1.0 网站中的 SynchronizationContext 是否为 null?此代码在我的系统上引发异常:

        app.Use(async (context, next) =>
{
var sc = System.Threading.SynchronizationContext.Current;
if (sc == null)
{
throw new Exception("SynchronizationContext is null");
}

最佳答案

它在 ASP.NET 5 中消失了,因为您不需要它的功能。它的全部目的是传递已经消失的 HttpContext.Current。

I think it was also doing something with the current culture but I am not sure how that is handled now.

关于asp.net-core - ASP.NET Core 1.0 同步上下文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31471167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com