-
Notifications
You must be signed in to change notification settings - Fork 11
Home
Welcome to the AspNet-WebApi wiki!
Quote from an MDN article:
Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell a browser to let a web application running at one origin (domain) have permission to access selected resources from a server at a different origin. A web application makes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, and port) than its own origin.
By default, all origins are allowed. You can set up origin by uncommenting this line in web.config. To specify more than one origin split them by semicolon.
For example:
<appSettings>
<add key="allowed-origins" value="http://localhost:5000; https://api.some-domain.com"/>
</appSettings>
If you want more control you can adjust CORS-policy in App_Start/CorsConfig.cs.
More information can be found here.
Dependency Injection is a form of inversion of control that supports the dependency inversion design principle.
This project uses Autofac as an IoC Container but it can be replaced with any other if you will.
First, you should configure the container. It can be done in RegisterServices method in App_Start/AutofacConfig.cs file.
For example:
builder.RegisterType<Services.WebDavFileStore>().As<Services.IFileStore>().SingleInstance();
builder.RegisterType<Services.ImageMetadataLoader>().As<Services.IImageMetadataLoader>();
builder.RegisterType<Services.ImageRotationService>().AsSelf();
Content
- Getting Started
- Using PackageReference instead of package.config
- Cross-Origin Resource Sharing (CORS)
- Dependency Injection
- Automapper
- Logging
- Cache control
- Unhandled exceptions logging
- Unhandled exceptions handling
- Content formatting
- Using environment variables in configuration options
- Documenting API
- Using EntityFramework