question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swashbuckle.Core - Method MapHttpRoute not found

See original GitHub issue

I’ve installed Swashbuckle 5.3.2. in my ASP .NET Web API 5.3.2. project. When trying to enable Swagger using the following code

GlobalConfiguration.Configuration.EnableSwagger(c => { c.OperationFilter<ExamplesOperationFilter>(); }).EnableSwaggerUi();

I get the following MissingMethodException

"An exception of type ‘System.MissingMethodException’ occurred in Swashbuckle.Core.dll but was not handled in user code

Additional information: Method not found: ‘System.Web.Http.Routing.IHttpRoute System.Web.Http.HttpRouteCollectionExtensions.MapHttpRoute(System.Web.Http.HttpRouteCollection, System.String, System.String, System.Object, System.Object, System.Net.Http.HttpMessageHandler)’."

I’m not able to find a solution to this specific problem. Any ideas?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

5reactions
ccregocommented, Nov 8, 2018

In order to sort out the issue, was necessary to replace the following binding redirect:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.2.0.0" />
      </dependentAssembly>
</assemblyBinding>

By the next one:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
        <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
      </dependentAssembly>
</assemblyBinding>
1reaction
PoulNielsencommented, Oct 13, 2016

@markus-bergendahl & @markshiffer , Same issue here, Swashbuckle 5.4.0 and AspNet.WebApi 5.2.3. Seems like @markshiffer is right, seems like dll version issue. I fixed it, by added following to my web.config under /configuration/runtime/assemblyBinding/ :

    <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
    </dependentAssembly>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Swashbuckle.Core - Method MapHttpRoute not found #784
I've installed Swashbuckle 5.3.2. in my ASP .NET Web API 5.3.2. project. When trying to enable Swagger using the following code.
Read more >
Swashbuckle 5 can't find my ApiControllers
I'm able to see controllers that do not directly implement APIController when using Swashbuckle/swagger on a local webapi project. I also tested ...
Read more >
How to Setup Swagger in Web API ASP.NET ...
I did a little research and I came across Swashbuckle which makes adding Swagger UI into your asp.net Web API project a no...
Read more >
Attribute Routing in ASP.NET Web API 2
Attribute routing can be combined with convention-based routing. To define convention-based routes, call the MapHttpRoute method.
Read more >
Exception Handling (2), In ASP.NET MVC Web API
An exception filter is executed when a controller method throws any unhandled exception that is not an HttpResponseException exception. The ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found