首页 > 解决方案 > .Net Framework - 无法调试 Owin API 控制器

问题描述

我在 .NET Framework 4.8 中有一个使用 Owin 的 Web API。我有以下启动代码:

        _callHttpServer = WebApp.Start(
            callServerOwinStartOptions,
            (appBuilder) =>
            {
                var httpConfig = new HttpConfiguration();
                httpConfig.MapHttpAttributeRoutes();
                httpConfig.EnsureInitialized();
                httpConfig.ConfigureSwagger();
                appBuilder.UseWebApi(httpConfig);
            }
        );

但是,当我在我的一个ApiController类中设置断点时,它永远不会被命中,即使我知道路由正在运行。此外,我看不到Console.WriteLine()添加到控制器的任何语句的输出。

有什么问题?我该如何进行这项工作?

标签: c#.netvisual-studioowin

解决方案


推荐阅读