Skip to content

diploi/component-asp

Repository files navigation

icon

ASP.NET Component for Diploi

launch with diploi badge component on diploi badge latest tag badge

Operation

Getting started

  1. In the Dashboard, click Create Project +
  2. Under Pick Components, choose ASP.NET. Here you can also add a frontend framework to create a monorepo app
  3. In Pick Add-ons, you can add one or multiple databases to your app
  4. Choose Create Repository to generate a new GitHub repo
  5. Finally, click Launch Stack

Link to the full guide - upcoming

Development

During development, the container uses dotnet watch to enable automatic reloads when files change. The development server is started with:

dotnet watch run --no-launch-profile --hot-reload --non-interactive

This will:

  • Use dotnet watch to monitor for changes to C# source files and restart the server when changes are detected.
  • Run the ASP.NET application with hot reload enabled.
  • Start the app on port 5103.
  • Avoid using any launch profile so environment variables are controlled by the container.

Installing Packages

NuGet packages (C# libraries and frameworks):

dotnet add package <PackageName>

For example:

dotnet add package Newtonsoft.Json
dotnet add package Microsoft.EntityFrameworkCore.SqlServer

Important: After installing packages, open the Deployment page and restart the running ASP.NET container so it loads the new dependencies.

Production

Builds a production-ready image. During the build, dependencies are restored with dotnet restore and the application is published with dotnet publish. When the container starts, it runs:

dotnet component-asp.dll

This uses the compiled .NET application optimized for production deployment.

Data Protection

The application uses ASP.NET Core Data Protection for securing authentication cookies and anti-forgery tokens. In Kubernetes deployments, data protection keys are persisted using a PersistentVolumeClaim to ensure session continuity across pod restarts.

Links