【发布时间】:2017-12-06 12:01:42
【问题描述】:
我想进入/调试 web-api 2(版本 5.2.3)代码源以了解它。
我创建了一个简单的 web api 应用程序,并且在 WebApi.config 中,我在这一行设置了一个断点:
config.Routes.MapHttpRoute(
name: "ExcludedRoute",
routeTemplate: "api/{controller}/{action}",
defaults: new { id = RouteParameter.Optional },
constraints: new { Controller = "healthcheck", action = "check" }
);
我可以进入 MapHttpRoute 方法和其他类,但调试器无法从图片下方的 System.Web dll 进入 Route 类:
我还使用 dotpeek 工具从 bin 文件夹生成 pdb 文件,方法是将引用程序集的“复制本地”功能设置为 true,但没有成功。 system.web dll的路径是
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Web.dll
我想知道为什么调试器无法进入属于 system.Web dll 的 Route 类,它的版本是 4.0,而 web.api 的版本是 5.2.3。
在我的搜索中,我下载了asp.net的代码源,发现项目System.Web.Http.WebHost包含HttpWebRoute类。
有什么想法吗?
谢谢!
【问题讨论】:
标签: asp.net debugging asp.net-web-api visual-studio-debugging