Web Application ASP.Net IIS
App Middleware Server Host
Host / IIS Server ASP.Net Web API Web Application
Image Source : MSDN
config.Routes.MapHttpRoute( name: “DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional} ); public IEnumerable GetResource () { … }
[HttpGet(“Demographics/{zipcode?}")] public Demographics Get(int? zipcode) { … } [HttpGet("people/{id:int}")] public Person Get(int id) { … } [HttpGet("people/{name:alpha}")] public Person Get(string name) { … } [HttpGet("Demographics/{zipcode=98052}")] public Demographics Get(int zipcode) { … } config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional });
NameDescription ClientCertificateGets or sets the client certificate. ConfigurationGets or sets the configuration. IncludeErrorDetail Gets or sets a value indicating whether error details, such as exception messages and stack traces, should be included in the response for this request. IsLocal Gets or sets a value indicating whether the request originates from a local address. Principal.Gets or sets the principal RouteDataGets or sets the route data. Url Gets or sets the factory used to generate URLs to other APIs. VirtualPathRootGets or sets the virtual path root.