如何在ConfigureAuth中设置断点?

How to set breakpoint in ConfigureAuth?

我需要在 ConfigureAuth 中设置断点来调试我们遇到的问题。
以下文章声称您可以设置断点,但这篇文章是 C# 的,我需要它才能在 VB.NET
中工作 https://coding.abel.nu/2014/06/understanding-the-owin-external-authentication-pipeline/
我转换了这个:

app.Use(async (context, next) =>
{
  await next.Invoke();
});

为此:

app.Use(Async Function(context, [next])
            Await [next].Invoke()
        End Function)

但我收到以下错误:

Parameter count mismatch.

这里有几个问题。

  1. 我假设 "context" 是 "Microsoft.Owin.OwinContext" 但这是一个无效的假设。 "context"在VB项目中我认为是"Microsoft.Owin.Security.Cookies.CookieAuthenticationMiddleware"
  2. 我不知道 "next"
  3. 的类型是什么

在此处找到 Is it possible to debug Global.asax?
John Kelly

这让我可以从 global.asx

开始
  1. 将调试器附加到 IIS 进程。
  2. 打开global.asax文件并设置断点。
  3. 在web.config文件中添加一个space并保存文件(这会导致当前的web应用程序重置);
  4. 刷新/转到站点上的网页。
  5. 当调试器在您的断点处停止时,您会大吃一惊。 :)

您还可以使用 Visual Studio 插件 Attach To All The Things 附加到 IIS 或 IIS Express,这样您就可以在 Global.asax 或 Startup.cs class.

https://marketplace.visualstudio.com/items?itemName=thebread.AttachToAllTheThings

我遇到了同样的参数计数不匹配问题并遇到了这个 https://github.com/aspnet/AspNetKatana/issues/84

基本上VB等价物是这样写的

AppBuilderUseExtensions.Use(app, Async Function(context, [next]) As Task
                                     Await [next]()
                             End Function)