Migrating from ASP.NET 4.6 to ASP.NET Core 2.0



Last updated: January 28th, 2024

Why Upgrade?

I believe that Microsoft, and the developer community surrounding it, wants to move forward into open source. ASP.NET Core, which has gone through many names and iterations in the last few years, recently came out with its 2.0 release.

I wanted to upgrade because:

  • ASP.NET Core is an opt in model, you pick which libraries you want rather than drag around large files, that you might not need, with every project
  • It's open source so individuals can see how it works and make changes
  • The performance and throughput is higher in some scenarios
  • It allows for cross-platform development (Linux, Mac, Windows)
  • Better build and deployment experience with "dotnet TASKNAME" on the command line

Upgrade Options

You will need to get the latest ASP.NET Core SDK to use Core 2.0. You'll also need a version of Visual Studio like 2017, which can use it to the fullest.

Once you have all the software installed, you can utilize ASP.NET Core 2.0 in a few ways. It is possible to reference DLLs directly that work with the 4.6x framework. This is a valuable option with little changes required.

Alternatively, you can start from scratch and move files over individually. I decided to do this for a clean start. Most of the existing APIs are present so for this blog, there wasn't much of an issue except with a few HttpContext related members. More extensions are required to get things like the IP Address and current URL easily.

I was able to migrate the entire blog site, page by page, file by file, in one day. I do not believe any features were lost in the process, I was able to use the dependency injection framework and deployment process easily.

Results

After upgrading this website to ASP.NET Core, I find the Membership APIs to be easier, the deployment process simpler and the development process a bit faster.

The only real features I added during the migration were WWW and HTTPS redirection modules. The HTTPS module was built into a library, it was easy to use the method in the Startup.cs file. I also added a WWW redirection module which also connects in via Startup.cs.

The opt in model for processing requests is far more logical than editing a Web.config XML file. This may be the most immediate difference I found beneficial.


Comments

No Comments

Post Comment

Prove you are human 6 + 3 =

Tagged: ASP.NET


Join my email list!



ryan
About Me

With 15 years in tech, I've excelled as a senior software engineer, specializing in ASP.NET, C#, SQL, Azure, and front-end technologies. I've led diverse projects across various sectors, from startups to global corporations, particularly during my decade in the San Francisco Bay Area.


Sign Up With SoftSys Hosting! (My host)