Last active
December 12, 2015 02:59
-
-
Save choudeshell/4703750 to your computer and use it in GitHub Desktop.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>
Multiple types were found that match the controller named 'Test'. This can happen if the route that services this request ('api/v1/hello') found multiple controller…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web.Http; | |
namespace MvcApplication1 | |
{ | |
public static class WebApiConfig | |
{ | |
public static void Register(HttpConfiguration config) | |
{ | |
// Controller: MvcApplication1.Controllers.V1.Test | |
config.Routes.MapHttpRoute( | |
name: "HelloV1", | |
routeTemplate: "api/v1/hello", | |
defaults: new { id = RouteParameter.Optional, controller = "Test", action = "Hello" } | |
); | |
// Controller: MvcApplication1.Controllers.V2.Test | |
config.Routes.MapHttpRoute( | |
name: "HelloV2", | |
routeTemplate: "api/v2/hello_v2", | |
defaults: new { id = RouteParameter.Optional, controller = "Test", action = "Hello_V2" } | |
); | |
config.Routes.MapHttpRoute( | |
name: "DefaultApi", | |
routeTemplate: "api/{controller}/{id}", | |
defaults: new { id = RouteParameter.Optional } | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment