title: Web API 2 versioning with Microsoft.AspNet.WebApi.Versioning
body: <p>I am using <a href="https://github.com/microsoft/aspnet-api-versioning" rel="nofollow noreferrer">ASP.NET Versioning Library</a>, I have followed steps to add this library to a very basic ASP.NET Web API 2 project, Here are the contents of my files:
  <code>Global.asax</code> file:</p>
  
  <pre><code> public class WebApiApplication : System.Web.HttpApplication
      {
          protected void Application_Start()
          {
              AreaRegistration.RegisterAllAreas();
              GlobalConfiguration.Configure(WebApiConfig.Register);
              FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
          }
      }
  </code></pre>
  
  <p>Web API Config:</p>
  
  <pre><code>  public static class WebApiConfig
      {
          public static void Register(HttpConfiguration config)
          {
              config.MapHttpAttributeRoutes();
              config.AddApiVersioning(c =&gt; c.AssumeDefaultVersionWhenUnspecified = true);   
          }
      }
  </code></pre>
  
  <p>First controller:</p>
  
  <pre><code>namespace WebApplication5.Controllers
  {
      [ApiVersion("1.0")]
      [RoutePrefix("api1")]
      public class ValuesController : ApiController
      {
          [Route("values")]
          public IEnumerable&lt;string&gt; Get()
          {
              return new string[] { "value1", "value2" };
          }
          [Route("values/{id}")]
          public string Get(int id)
          {
              return "value";
          }
      }
  }
  </code></pre>
  
  <p>Second controller:</p>
  
  <pre><code>namespace WebApplication5.Controllers
  {
      [ApiVersion("2.0")]
      [RoutePrefix("api1")]
      [ControllerName("Values")]
      public class ValuesController2 : ApiController
      {
          [Route("values")]
          public IEnumerable&lt;string&gt; Get()
          {
              return new string[] { "value1", "value2" };
          }
          [Route("values/{id}")]
  
          // GET api/values/5
          public string Get(int id)
          {
              return "value";
          }
      }
  }
  </code></pre>
  
  <p>When I run the application and navigate to this url: <code>http://localhost:5428/api1/values?api-version=1.0</code> I get the desired results, But When I navigate to this url: <code>http://localhost:5428/api1/values?api-version=2.0</code> I encounter an error message stating that <code>No route providing a controller name with API version '2.0' was found to match request URI 'http://localhost:5428/api1/values'</code>, I was wondering what am I missing in this basic setup? </p>
  
  <p>If I remove <code>[ControllerName]</code> attribute from <code>ValuesController2</code> nothing changes and the issue persists.</p>
  
  <p>I tried to change the namespace of the second controller, But It didn't solve the problem either !</p>
  
  <p>I am using version <a href="https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Versioning" rel="nofollow noreferrer">3.0.1</a> of this library.</p>