3

In Visual Studio 2015 (Enterprise), is there still no built-in tool that will dissect and display the routing information for WebAPI calls?

WebApi Route Debugger does not seem to work for ASP.NET 5 (and mangles the default Help page in the template)

Glimpse does not offer the "Launch Now!" button anymore from what I can tell (http://blog.markvincze.com/use-glimpse-with-asp-net-web-api/).

RichardTheKiwi
  • 105,798
  • 26
  • 196
  • 262
  • Use Chrome's PostMan tool – ravindra Aug 24 '16 at 06:43
  • Supposedly the beta version currently out supports web api, but I haven't confirmed that. I don't know of any tools that will do it, but if you are debugging, I believe that the RequestContext might contain what you are looking for, along with the UrlHelper. You might be able to create a filter that would help you inspect the routes. – MichaelDotKnox Aug 24 '16 at 18:58
  • Glimpse does offer Launch now button. Is it missing from your glimpse? – Md. Tazbir Ur Rahman Bhuiyan Sep 06 '16 at 12:10
  • Possible duplicate of [Is there a way I can debug a route in ASP. MVC5?](https://stackoverflow.com/questions/19058463/is-there-a-way-i-can-debug-a-route-in-asp-mvc5) – Liam Jun 20 '18 at 09:00

1 Answers1

14

RouteDebugger is good for figuring out which routes will/will not be hit.

http://nuget.org/packages/routedebugger but you are saying it doesn't work. After some googling I found another solution to your problem,

Add an event handler in Global.asax.cs to pick up the incoming request and then look at the route values in the VS debugger. Override the Init method as follows:

public override void Init()
{
    base.Init();
    this.AcquireRequestState += showRouteValues;
}

...

protected void showRouteValues(object sender, EventArgs e)
{
    var context = HttpContext.Current;
    if (context == null)
        return;
    var routeData = RouteTable.Routes.GetRouteData(new HttpContextWrapper(context)); 
}

Then set a breakpoint in showRouteValues and look at the contents of routeData.

Keep in mind that in a Web Api project, the Http routes are in WebApiConfig.cs ... not RouteConfig.cs

but that's not a tool. may be digging up some thread would help you resolve your issue.

Reference: Is there a way I can debug a route in ASP. MVC5?

Community
  • 1
  • 1