[英]LinqToTwitter Async not working / 'The name 'await' does not exist in the current context' and other pains
[英]async, await, context and next does not exist in the current context
我剛剛使用 Core 2.2 創建了一個新的空 Web 應用程序,並想添加一個中間件,但我不允許這樣做。
app.Use(async (context, next)) =>
{
await next;
}
但它不能識別異步、上下文、下一步或等待。 我試過在線搜索,但沒有遇到任何關於這個微不足道的問題。 有誰知道是什么原因造成的? 我正在使用社區 2019
它應該是
app.Use(async (context, next) =>
{
await next();
})
app.Use()
接受一個函數作為參數,但你只傳遞async (context, next)
作為參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.