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.