• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WittySparks Logo White

WittySparks

Ignite Your Thoughts

  • Topics
  • Reviews
  • Newsletter
WittySparks / Technology / Programming / 5 Lessons Learned While Migrating from ASP.NET to ASP.NET Core

5 Lessons Learned While Migrating from ASP.NET to ASP.NET Core

Updated: June 8, 2023 by Pranjal Mehta • 3 min read

ASP.NET VS ASP.NET Core

Let me start by mentioning the best thing about the new ASP.NET Core. – The new ASP.NET Core is independent of the Microsoft ecosystem.

This means it is now possible to develop ASP.NET applications on other platforms such as Linux and Mac.

Although this is not it, there are many new improvements to the new ASP.NET Core framework, which are listed below.

  • ASP.NET Core provides support for more than 32,000 APIs.
  • The new .NET Standard 2.0 released along with ASP.NET Core has added a new compatibility shim that allows any application developed using .NET Core to refer to any full framework library.
  • ASP.NET Core offers better portability of codes to the new .NET Standard 2.0 library without requiring any major changes.
  • Lastly, when .NET Core version 1.0 was released, it didn’t have logging libraries as log4net wasn’t available. However, it has been added now using which you can now easily deploy Mac or Linux applications.

After learning about all these improvements, I finally decided to move an existing ASP.NET application to ASP.NET Core.

Here are the lessons that I learned while doing so.

On this page
  • LESSON No. 1 – IIS is dead (kind of)
  • A New Middleware replaces LESSON No. 2 – HttpHandlers & HttpModules.
  • LESSON No. 3 – The StreamReader Constructor Does No Longer Work With a File Path
  • LESSON No. 4 – Web API is Now a Part of MVC
  • LESSON No. 5 – Basic Classes Have Been Moved Around to Different Packages
  • Final Thoughts

LESSON No. 1 – IIS is dead (kind of)

IIS isn’t really dead. You can still use it as a reverse proxy sitting in front of Kestrel to leverage IIS’s benefits that Kestrel does not have.

What is this Kestrel, though? – Kestrel is basically an essential part of the .NET Core framework that allows deploying any web app as easy as deploying a console app. In simple terms, all the self-hosted packages for web API, SignalR, and others are not needed anymore. Every web app developed using ASP.NET Core becomes self-hosted now.

A New Middleware replaces LESSON No. 2 – HttpHandlers & HttpModules.

The new middleware in ASP.NET Core has been designed to replace both handlers and modules. It is basically how Owin and other platforms handle this kind of functionality. In fact, Middleware is easier to work with. And, you will not be able to configure them in a config file either. With new Middleware, both are set in code. You can learn more about it in ASP.NET docs.

LESSON No. 3 – The StreamReader Constructor Does No Longer Work With a File Path

Actually, many simple uses of standard libraries have been changed. For example, in ASP.NET, the StreamReader was frequently used by passing in a file path, but in the new ASP.NET Core, you will have to pass it in a stream. As a result, it may require small refactorings to use a FileStream, in addition to StreamReader everywhere.

Another good example of a change in the use of standard libraries is the use of GetType(). The standard library now returns a better version of the object (more simplified) for better performance reasons.

LESSON No. 4 – Web API is Now a Part of MVC

Both Microsoft and the community have decided to merge Web API and MVC with the release of the new ASP.NET Core. The reason is that Both Web API and MVC follow the same pattern for controllers and actions. Secondly, the Web API did not have a view engine like a Razor and was designed to be useful for REST APIs.

MVC, on the other hand, was created for standard web application development with HTML front-ends. As you can see, merging Web API and MVC made sense in many ways. So they merged them.

LESSON No. 5 – Basic Classes Have Been Moved Around to Different Packages

While I do not know why some basic classes, such as FileStream, are no longer in the System.IO package, instead, you’ll have to add the package System.IO.FileSystem.

These changes in basic classes may be confusing, mainly because we generally use class namespaces that don’t directly match the packages. But to clear the confusion, I have found a website that shows where some classes have been moved around.

Final Thoughts

Microsoft has indeed made everything right with the release of ASP.NET Core. It is basically an interesting web framework to learn or build web applications to shoot MVPs quickly in the market.

Overall, this has been an interesting experience for me and my team and has helped us to Migrate and develop the ASP.NET Core application from scratch.

Related Topics

  • PHP: Is it the best Programming Language ever?
  • How To Build A Great Search Box On Your Website
  • How to make Python3 version default in Windows OS?
  • Latest Java Technologies & Trends for 2020

Topic: Programming

Profile picture for Pranjal Mehta Article by

Pranjal Mehta

Founder of Zealous System
WittySparks Leadership Network Contributors

Pranjal Mehta is a technology strategist and the Founder and Managing Director of Zealous System, which provides innovative and cutting-edge technology models and services to businesses. He has a fierce passion for technology, which is why he is deeply committed to delivering solutions to the key problems faced by Startups as well as Enterprises.

View all posts by Pranjal Mehta

Primary Sidebar

Featured Productivity Software

Notion logo
Notion

Notion Workspace can help you stay organized, get started today, and take your productivity to the next level.

Try Notion for FREE

And take this Notion Masterclass by Ali Abdaal for FREE by using coupon code WITTYSPARKSFREE.

The Best Digital Marketing Tool

Semrush logo
Semrush

Grow your business on your terms and get to the top with 55+ marketing tools in 1. Get a flat 40% discount on Semrush Guru plan or Try 14-day PRO Trial.

Try Semrush for FREE

Footer

Explore Topics

  • Technology
  • Business
  • Marketing
  • SEO
  • View All Topics

Sponsors

Partnered with FreePik to use the licensed images.

turn to dhgate for smartphone

Affiliate Link Disclosure

If you make a purchase from links, we will receive a small commission. See our Affiliate Disclosure.

Follow Us

  • Facebook
  • Twitter
  • Pinterest
  • LinkedIn
  • Instagram
  • YouTube
  • RSS
  • Mastodon

Copyright © 2023 WittySparks - All rights reserved.
Hosted on Rocket.net

  • About Us
  • Contact Us
  • Privacy Policy