
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
How to configure C# ASP.NET WebAPI in web.configure file?
No we cannot configure WEB API in web.configure file.
Web API supports code based configuration. It cannot be configured in web.config file.
We can configure WEB API, to customize the behaviour of Web Api hosting Infrastructure and component such as
Routes
Formatters
Filters
Dependency Resolver
Message Handlers
ParameterBindingRules
Properties
Services
Routes − The public methods of the controller are called action methods or simply actions.
When the Web API framework receives a request, it routes the request to an action. To determine which action to invoke, the framework uses a routing table
routes.MapHttpRoute( name: "API Default", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } );
Formatters −
ASP.NET Core MVC supports data exchange in Web APIs using input and output formatters. Input formatters are used by Model Binding. Output formatters are used to format responses.
Use a custom formatter to add support for a content type that isn't handled by the built-in formatters.
Filters − Filters can be used to provide cross-cutting features such as logging, exception handling, performance measurement, authentication and authorization.
Dependency Resolver − Web API defines the IDependencyResolver interface for resolving dependencies.
Message Handlers − Message handlers in Web API provides a process, edit, or decline an incoming request before it reaches the HttpControllerDispatcher.
ParameterBindingRules −When Web API calls a method on a controller, it must set values for the parameters, a process called binding.
- Related Articles
- How to resolve CORS issue in C# ASP.NET WebAPI?
- How can we test C# Asp.Net WebAPI?
- How to do versioning with accept header in C# ASP.NET WebAPI?
- How do we specify MIME type in Asp.Net WebAPI C#?
- What is Content Negotiation in Asp.Net webAPI C#?
- What is parameter binding in C# ASP.NET WebAPI?
- How to do Web API versioning with URI in C# ASP.NET WebAPI?
- How to do versioning with the Querystring parameter in C# ASP.NET WebAPI?
- How to do versioning with custom media type in C# ASP.NET WebAPI?
- How to consume Asp.Net WebAPI endpoints from other applications using C#?
- How to add custom message handlers to the pipeline in Asp.Net webAPI C#?
- What are built-in message handlers in Asp.Net webAPI C#?
- How to return custom result type from an action method in C# ASP.NET WebAPI?
- What is the usage of DelegatingHandler in Asp.Net webAPI C#?
- What are the advantages of using C# ASP.NET WebAPI?
