My C # cross-platform Journey (iv): Using AOP for system enhancements

Source: Internet
Author: User
Tags oauth log4net

    • Using OData to speed up rest API development
      • Introducing the NuGet package: Microsoft.AspNet.WebApi.OData
      • Add the following configuration in the Startup class (examples are global, or can be implemented based on a controller or action):

    • Use Cors for cross-domain access:
      • Introducing the NuGet package: Microsoft.AspNet.WebApi.Cors
      • Add the following configuration in the Startup class (examples are global, or can be implemented based on a controller or action):

    • Use OAuth 2 for identity authentication:
      • Introducing the NuGet package: Microsoft.Owin.Security.OAuth
      • Create Applicationoauthprovider Class (Generate Beaer Token after successful login):

      • To enable OAuth authentication in the Startup class:

    • Enable swagger to expose and debug the rest API:
      • Introducing the NuGet package: Swashbuckle.core
      • To add the Httpheaderfilter class:

      • In the Startup class configuration, enable swagger:

    • Log system logs using log4net:
      • Introducing the NuGet package: log4net
      • Configure in app. config:

      • Start the log4net in the startup class;

      • Add the following code where you want the log to be entered:

My C # cross-platform Journey (iv): Using AOP for system enhancements

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.