diff --git a/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpApiVersioningOptionsExtensions.cs b/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpApiVersioningOptionsExtensions.cs index 689b378255..372b216583 100644 --- a/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpApiVersioningOptionsExtensions.cs +++ b/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpApiVersioningOptionsExtensions.cs @@ -1,5 +1,6 @@ using System.Linq; using System.Reflection; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Versioning; using Microsoft.AspNetCore.Mvc.Versioning.Conventions; using Volo.Abp.AspNetCore.Mvc; @@ -53,10 +54,13 @@ namespace Microsoft.Extensions.DependencyInjection } else { - typeof(ControllerApiVersionConventionBuilder<>) - .MakeGenericType(controllerType) - .GetMethod("IsApiVersionNeutral") - .Invoke(controllerBuilder, null); + if (!controllerType.IsDefined(typeof(ApiVersionAttribute), true)) + { + typeof(ControllerApiVersionConventionBuilder<>) + .MakeGenericType(controllerType) + .GetMethod("IsApiVersionNeutral") + .Invoke(controllerBuilder, null); + } } } } diff --git a/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/FixtureController.cs b/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/FixtureController.cs index eca154f6ab..74d831e65e 100644 --- a/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/FixtureController.cs +++ b/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/FixtureController.cs @@ -10,22 +10,22 @@ namespace Volo.Abp.Identity [Route("api/v{api-version:apiVersion}/identity/fixture")] public class FixtureController : AbpController, IRemoteService { - [HttpGet] + [HttpGet, MapToApiVersion("2.0")] public int Get() { - return 42; + return 41; } - //[HttpGet, MapToApiVersion("3.0")] - //public int Get3() - //{ - // return 42; - //} + [HttpGet, MapToApiVersion("3.0")] + public int Get3() + { + return 42; + } [HttpPost] public int Post() { - return 42; + return 43; } } } \ No newline at end of file