sql-serverasp.net-mvcdatabase.net-coreweb-deployment

Deploying ASP.NET CORE Web application


I am making a web application and am following tutorials on getting started with ASP.NET Core programming.

So far I have created a local SQL Server database with Entity Framework and all is fine. I want to ask about deployment.

I wish to deploy the website to a hosting server and was wondering whether the application will deploy together with the database or how to make a database work with the application on the web.

I would appreciate precise explanations and/or articles because I am confused and some articles claim that the SQL Server will need some installations and configurations.

What database type is best for .NET Core Web Apps which makes it easy for deployment? How do I make or deploy a Database to work with my web application?

I will appreciate a precise answer.


Solution

  • Depends on your needs. SQL Server is the default in EF Core, but proprietary and expensive. I prefer open source software (.NET Core itself is OS, too!) and so I'm using MySQL together with EntityFramework and the Pomelo.EntityFrameworkCore.MySql driver package. My MySQL knowledge is also larger by experience from other projects in the past before .NET Core (e.g. PHP). I have used this for years on .NET 1 as well as the current 2.1 LTS and it worked well.

    There is no best database at all because there are good database for each workload. For example, when having unstructured data, a NoSQL database could do the job probably better than any RDBMS.

    I'd choose the database by

    1. Type of data
    2. Existing experience and time/wish to try something new (in correlation with #1 - I would not use e.g. CouchDB just to try out CouchDB, even this doesn't make any sense for the project)
    3. Open source vs closed source with benefits and drawbacks (when relevant, e.g. if you want to choose between MySQL and SQL Server)

    Application hosting

    Generally, you need a database instance of MySQL, SQL Server or whatever DBMS you choose. This could be an existing one, or a new instance. For example deployed on Docker, or a VM. Maybe also hosted database instances in the cloud, if this is suitable in terms of data protection. This mainly depends to your current situation. In a company you may not be able to choose each database. As a private person or freelancer, you may have more freedom.

    You should think about the architecture of your entire software stack. There would be at least an ASP.NET Core app-server and database server. Maybe also some reverse proxy server, depending to your needs.

    A few question which you could answer for yourself to get an idea of the hosting: