.NET Core is a cross-platform and open-source framework by Microsoft for building web, desktop, and console applications. Unlike the traditional .NET Framework, .NET Core works on Windows, Linux, and macOS, making it perfect for cloud and container-based apps.
AccuWeb.Cloud provides one-click installation for .NET Core applications. You can also connect your .NET Core app to a remote MSSQL Server, whether it’s on Linux or Windows.
Below, we have listed all the steps to help you install and configure .NET Core with a remote MSSQL Server on AccuWeb.Cloud
Installing .NET Core on AccuWeb.Cloud
You can easily install .NET Core on AccuWeb Cloud using the Environment Topology feature. Select the required resources, click Create, and your setup is ready!
Steps to Install .NET Core:
Step 1: Log in to your AccuWeb.Cloud dashboard.
Step 2: Click New Environment on the upper left to open Environment Topology.
Step 3: Select .NET from the top menu, then choose your .NET Core version under Application Server (e.g., .NET Core 8.0.407).
Step 4: In the Vertical Scaling per Node section, set the required Reserved and Scaling Limit cloudlets (e.g., 8 Reserved, 16 Scaling Limit).
You can change this later under “Change Environment Topology.”
Step 5: Enter a name for your environment in the Environment Name field.
Step 6: Click Create to start the installation.
Step 7: Once installed, you’ll get a confirmation email.
Your .NET Core environment is now ready! You can start building and deploying your application on AccuWeb.Cloud.
Create a .NET Core Application on AccuWeb.Cloud
When you install .NET Core from Environment Topology, the system automatically sets up the SDK and Runtime for the selected version. This allows you to create or deploy a .NET Core application on AccuWeb.Cloud.
Steps to Create and Deploy a .NET Core Application
Step 1: Access the Environment
Open the environment where you installed .NET Core. Click Web SSH next to the Application Server.
Step 2: Navigate to the Document Root
In the SSH terminal, go to the .NET Core document root:
cd APP/ROOT
By default, the system starts at /home/jelastic, so you only need to enter APP/ROOT.
Step 3: Set Up Your Application
If you want a new .NET Core app, you can delete all files in the ROOT folder or
Create a new folder inside APP and add your files there.
If you already have a .NET Core project, just upload and replace the files in the ROOT folder.
Step 4: (Optional) Create a Backup
Run these commands to back up existing files:
mkdir ~/BACKUP
cp -r ~/APP/ROOT/* ~/BACKUP/
Step 5: Delete Old Files
If starting fresh, remove all files in the ROOT folder:
rm -rf ~/APP/ROOT/*
Step 6: Create a New MVC Project
Run the following command to generate a basic MVC app:
cd ~/APP/ROOT
dotnet new mvc
This sets up a new MVC project inside the ROOT directory.
Step 7: Create a Model (Book.cs)
Inside the Models folder, create a file Book.cs:
namespace BookApp.Models
{
    public class Book
    {
        public int Id { get; set; }
        public string? Title { get; set; }
        public string? Author { get; set; }
        public string? Description { get; set; }
        public int PublishedYear { get; set; }
    }
}
Step 8: Set Up Database Context
Inside the Data folder, create AppDbContext.cs:
using Microsoft.EntityFrameworkCore;
using BookApp.Models;
namespace BookApp.Data
{
    public class AppDbContext : DbContext
    {
        public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
        public DbSet<Book> Books { get; set; }
    }
}
Now, your .NET Core application is set up and ready to be developed and deployed on AccuWeb.Cloud!
Connect to a Remote MSSQL Server in .NET Core
To connect your .NET Core application to a Remote MSSQL Server, you need database credentials like:
- Server IP address
- Port number (if not using the default 1433)
- Username and password
These credentials should be added to the appsettings.json file.
Steps to Integrate Remote MSSQL Server:
Step 1: Add Connection String
Edit the appsettings.json file (located in the ROOT folder) and add the connection string:
"ConnectionStrings": {
  "DefaultConnection": "Server=YOUR_REMOTE_IP,1433;Database=BooksDB;User Id=SA;Password=YourStrongPassword;TrustServerCertificate=True;"
}
Make sure: ✔ Port 1433 is open.
✔ The user has database access.
✔ The BooksDB database exists.
Step 2: Register Database in Program.cs
Modify Program.cs to register Entity Framework Core (EF Core) and load the connection string:
builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
This tells your app which database to use and how to connect to it.
Step 3: Install Entity Framework Core (EF Core)
Run the following commands to install EF Core packages:
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Tools
These packages help your app interact with the database.
Step 4: Add Migrations and Update Database
Now, create the necessary database structure using migrations:
dotnet ef migrations add InitialCreate
dotnet ef database update
- Migrations generate SQL scripts based on your C# models.
- Database update applies these changes to the actual database.
Your .NET Core app is now connected to the Remote MSSQL Server and ready to store data!
Add Controller and Views in ASP.NET Core MVC
In an ASP.NET Core MVC app, controllers handle user requests, process data, and return responses, while views display the response as an HTML page.
Together, controllers and views allow users to create, view, edit, and delete records in the application.
Add Controller and Views Automatically
Run the following command in the terminal to generate a BooksController along with its views:
dotnet aspnet-codegenerator controller -name BooksController -m Book -dc AppDbContext --relativeFolderPath Controllers --useDefaultLayout --referenceScriptLibraries
Create Manually (Alternative Option)
If you prefer, you can manually create:
- BooksController.cs inside the Controllers folder.
- Views inside Views/Books/.
Now your app can handle user interactions and display data!
Run and Test the .NET Core Project
To start your .NET Core project, go to the Document Root folder and run:
dotnet run
Then, open the temporary URL (your environment name) in your browser to check if the project is working.
You should see the Book Collection or any other content from your project.
Deploy the .NET Core App
To deploy your .NET Core application, run the following command in the terminal:
dotnet publish -c Release -o ./publish
This will build and save the app in the ./publish folder.
- You can run the app from this folder.
- To host it on a remote server, simply upload the contents of the ./publish folder there.
Conclusion:
Deploying a .NET Core application with a remote MSSQL database on AccuWeb.Cloud is easier than you might think. Just set up a new MVC project, connect it to your remote MSSQL database using Entity Framework Core, and deploy it to AccuWeb.Cloud, that’s it! You’ll have a fully functional web app with database integration in no time.
AccuWeb.Cloud offers a reliable and scalable hosting environment, making it simple to manage your code, run database migrations, and securely connect to external databases. With just a few quick configurations, your application can be up and running in minutes, ready for production.