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.

Any idea?

Method not found: ‘Swashbuckle.Application.SwaggerEnabledConfiguration Swashbuckle.Application.HttpConfigurationExtensions.EnableSwagger(System.Web.Http.HttpConfiguration, System.Action`1<Swashbuckle.Application.SwaggerDocsConfig>)’.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
phhlhocommented, Apr 4, 2017

Hoping I can help others that might run into this issue. To debug what was happening, I disabled the PreApplicationStartMethod of SwaggerConfig.cs and inserted the following code into a web api handler:

try
{
    var c = new SwaggerEnabledConfiguration(GlobalConfiguration.Configuration, s => "", new List<string>());
    Console.WriteLine("Success");
}
catch (Exception ex)
{
    Console.WriteLine("Failure");
    Console.WriteLine(ex.Message);
}

This gave me a much more descriptive error message:

Cannot convert from 'System.Web.Http.HttpConfiguration [System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]' to 'System.Web.Http.HttpConfiguration [System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]'

Using that error message, all I needed to do was update my binding redirects in the web.config and I was good to go:

      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.WebRequest" publicKeyToken="b03f5f7f11d50a3a" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>

Hope that can help someone else that finds this!

2reactions
shoaibadilcommented, Mar 12, 2018

Thanks @phhlho adding just reference if System.Web.Http, it worked for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Method not found on runtime
"Method not found" is a very specific error, which means a method it expected (i.e. was there at compile time) simply is not...
Read more >
System.MissingMethodException - Method not found in C#
To fix the Method not found error in C#, ensure that the latest assemblies are deployed and no duplicate or older assemblies are...
Read more >
MissingMethodException Class (System)
MissingMethodException is thrown when code in a dependent assembly attempts to access a missing method in an assembly that was modified. MissingMethodException ...
Read more >
Question - MissingMethodException: Method not found.
I've written a basic script that allows the player to slow time while they are aiming a weapon. Everything works fine until I...
Read more >
MissingMethodException / "Method not found" after update ...
MissingMethodException s usually indicate that you have old DLLs lurking around somewhere that are not binary-compatible with the version ...
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