Migrating from Asp.Net Web Api to Core

Cenk 956 Reputation points
2022-10-06T17:39:13.793+00:00

Hello,

We have a web API that has been running smoothly for 3-4 years. Now I want to upgrade it to Core Web API. I use logging, basic authentication, OAuth, and Unity in my Web API. Will I have a lot of problems with the upgrade? May I have your advice and suggestions? What should I pay attention to?

Thank you.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,234 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
304 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 57,731 Reputation points
    2022-12-16T16:57:20.17+00:00
    1 person found this answer helpful.
    0 comments No comments

  2. Bruce (SqlWork.com) 57,731 Reputation points
    2022-10-06T19:49:22+00:00

    common issues I have run into:

    1) stricter binding rules
    2) no xml request / response support by default
    3) 3rd party library doesn't have .net standard or core support
    4) use of HttpContext.Current (migrated to middleware)
    5) session not locked (should not be using with webapi anyway)

    0 comments No comments

  3. Zhi Lv - MSFT 32,036 Reputation points Microsoft Vendor
    2022-10-07T06:02:14.02+00:00

    Hi @Cenk ,

    .NET Core is a cross-platform rewrite of .NET Framework. There are many breaking changes between the two frameworks. You can refer to this article to understand the differences between ASP.NET and ASP.NET Core.

    Then, when migration, you could refer to the following articles to set the configuration, API controller and so on.

    Migrate from ASP.NET to ASP.NET Core

    Migrate from ASP.NET Web API to ASP.NET Core.

    Besides, since you are using logging, basic authentication, OAuth, and Unity. For this package or class library, you also need to change. In many cases, a replacement NuGet package exists to fill in any gaps left between .NET Framework and .NET Core. In rare cases, you may need to find a third-party solution or implement new custom code to address incompatibilities.

    [Note] When using or install the package, you'd better to check the package target framework, make sure it apply to the project version.

    Here are some relates articles about logging, authentication, and Identity, you can refer to them:

    Logging in .NET Core and ASP.NET Core

    Introduction to Identity on ASP.NET Core

    Simple authorization in ASP.NET Core


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion


  4. Cenk 956 Reputation points
    2022-12-11T11:11:45.057+00:00

    I want to improve at the same time as upgrading. In my Asp.net Web API application, I was using class libraries for Business Entity, Business Service, and DataModels. If I change all these class libraries as folders within the new API project, will I gain anything besides reducing the complexity?


  5. Cenk 956 Reputation points
    2022-12-16T07:01:25.347+00:00

    In my Asp.Net Web Api, I used code first with EF. I want to use the same database and the entities, should I use the database first approach? Can you help me?

    0 comments No comments