gebeurtenis
Power BI DataViz World Championships
14 feb, 16 - 31 mrt, 16
Met 4 kansen om in te gaan, kun je een conferentiepakket winnen en het naar de LIVE Grand Finale in Las Vegas maken
Meer informatieDeze browser wordt niet meer ondersteund.
Upgrade naar Microsoft Edge om te profiteren van de nieuwste functies, beveiligingsupdates en technische ondersteuning.
ASP.NET Core uses HTTPS by default. HTTPS relies on certificates for trust, identity, and encryption.
This document explains how to run pre-built container images with HTTPS.
See Developing ASP.NET Core Applications with Docker over HTTPS for development scenarios.
This sample requires Docker 17.06 or later of the Docker client.
The .NET Core 2.2 SDK or later is required for some of the instructions in this document.
A certificate from a certificate authority is required for production hosting for a domain. Let's Encrypt is a certificate authority that offers free certificates.
This document uses self-signed development certificates for hosting pre-built images over localhost
. The instructions are similar to using production certificates.
For production certificates:
dotnet dev-certs
tool is not required.The instructions contained in the following section volume mount certificates into containers using the volumes
property in docker-compose.yml. You could add certificates into container images with a COPY
command in a Dockerfile, but it's not recommended. Copying certificates into an image isn't recommended for the following reasons:
Use the following instructions for your operating system configuration.
Generate certificate and configure local machine:
dotnet dev-certs https -ep "$env:USERPROFILE\.aspnet\https\aspnetapp.pfx" -p $CREDENTIAL_PLACEHOLDER$
dotnet dev-certs https --trust
The previous command using the .NET CLI:
dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p $CREDENTIAL_PLACEHOLDER$
dotnet dev-certs https --trust
In the preceding commands, replace $CREDENTIAL_PLACEHOLDER$
with a password.
Create a docker-compose.debug.yml file with the following content:
version: '3.4'
services:
webapp:
image: mcr.microsoft.com/dotnet/samples:aspnetapp
ports:
- 80
- 443
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
- ASPNETCORE_Kestrel__Certificates__Default__Password=password
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
volumes:
- ~/.aspnet/https:/https:ro
The password specified in the docker compose file must match the password used for the certificate.
Start the container with ASP.NET Core configured for HTTPS:
docker-compose -f "docker-compose.debug.yml" up -d
Generate certificate and configure local machine:
dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p $CREDENTIAL_PLACEHOLDER$
dotnet dev-certs https --trust
On Linux, dotnet dev-certs https --trust
requires .NET 9 SDK or later. For Linux on .NET 8.0.401 SDK and earlier, see your Linux distribution's documentation for trusting a certificate.
In the preceding commands, replace $CREDENTIAL_PLACEHOLDER$
with a password.
Create a docker-compose.debug.yml file with the following content:
version: '3.4'
services:
webapp:
image: mcr.microsoft.com/dotnet/samples:aspnetapp
ports:
- 80
- 443
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
- ASPNETCORE_Kestrel__Certificates__Default__Password=password
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
volumes:
- ~/.aspnet/https:/https:ro
The password specified in the docker compose file must match the password used for the certificate.
Start the container with ASP.NET Core configured for HTTPS:
docker-compose -f "docker-compose.debug.yml" up -d
Generate certificate and configure local machine:
dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p $CREDENTIAL_PLACEHOLDER$
dotnet dev-certs https --trust
In the preceding commands, replace $CREDENTIAL_PLACEHOLDER$
with a password.
Create a docker-compose.debug.yml file with the following content:
version: '3.4'
services:
webapp:
image: mcr.microsoft.com/dotnet/samples:aspnetapp
ports:
- 80
- 443
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
- ASPNETCORE_Kestrel__Certificates__Default__Password=password
- ASPNETCORE_Kestrel__Certificates__Default__Path=C:\https\aspnetapp.pfx
volumes:
- ${USERPROFILE}\.aspnet\https:C:\https:ro
The password specified in the docker compose file must match the password used for the certificate.
Start the container with ASP.NET Core configured for HTTPS:
docker-compose -f "docker-compose.debug.yml" up -d
ASP.NET Core uses HTTPS by default. HTTPS relies on certificates for trust, identity, and encryption.
This document explains how to run pre-built container images with HTTPS.
See Developing ASP.NET Core Applications with Docker over HTTPS for development scenarios.
This sample requires Docker 17.06 or later of the Docker client.
The .NET Core 2.2 SDK or later is required for some of the instructions in this document.
A certificate from a certificate authority is required for production hosting for a domain. Let's Encrypt is a certificate authority that offers free certificates.
This document uses self-signed development certificates for hosting pre-built images over localhost
. The instructions are similar to using production certificates.
For production certificates:
dotnet dev-certs
tool is not required.The instructions contained in the following section volume mount certificates into containers using the volumes
property in docker-compose.yml. You could add certificates into container images with a COPY
command in a Dockerfile, but it's not recommended. Copying certificates into an image isn't recommended for the following reasons:
Use the following instructions for your operating system configuration.
Generate certificate and configure local machine:
dotnet dev-certs https -ep "$env:USERPROFILE\.aspnet\https\aspnetapp.pfx" -p $CREDENTIAL_PLACEHOLDER$
dotnet dev-certs https --trust
The previous command using the .NET CLI:
dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p $CREDENTIAL_PLACEHOLDER$
dotnet dev-certs https --trust
In the preceding commands, replace $CREDENTIAL_PLACEHOLDER$
with a password.
Create a docker-compose.debug.yml file with the following content:
version: '3.4'
services:
webapp:
image: mcr.microsoft.com/dotnet/samples:aspnetapp
ports:
- 80
- 443
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
- ASPNETCORE_Kestrel__Certificates__Default__Password=password
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
volumes:
- ~/.aspnet/https:/https:ro
The password specified in the docker compose file must match the password used for the certificate.
Start the container with ASP.NET Core configured for HTTPS:
docker-compose -f "docker-compose.debug.yml" up -d
Generate certificate and configure local machine:
dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p $CREDENTIAL_PLACEHOLDER$
dotnet dev-certs https --trust
dotnet dev-certs https --trust
is only supported on macOS and Windows. You need to trust certificates on Linux in the way that is supported by your distribution. It is likely that you need to trust the certificate in your browser.
In the preceding commands, replace $CREDENTIAL_PLACEHOLDER$
with a password.
Create a docker-compose.debug.yml file with the following content:
version: '3.4'
services:
webapp:
image: mcr.microsoft.com/dotnet/samples:aspnetapp
ports:
- 80
- 443
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
- ASPNETCORE_Kestrel__Certificates__Default__Password=password
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
volumes:
- ~/.aspnet/https:/https:ro
The password specified in the docker compose file must match the password used for the certificate.
Start the container with ASP.NET Core configured for HTTPS:
docker-compose -f "docker-compose.debug.yml" up -d
Generate certificate and configure local machine:
dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p $CREDENTIAL_PLACEHOLDER$
dotnet dev-certs https --trust
In the preceding commands, replace $CREDENTIAL_PLACEHOLDER$
with a password.
Create a docker-compose.debug.yml file with the following content:
version: '3.4'
services:
webapp:
image: mcr.microsoft.com/dotnet/samples:aspnetapp
ports:
- 80
- 443
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
- ASPNETCORE_Kestrel__Certificates__Default__Password=password
- ASPNETCORE_Kestrel__Certificates__Default__Path=C:\https\aspnetapp.pfx
volumes:
- ${USERPROFILE}\.aspnet\https:C:\https:ro
The password specified in the docker compose file must match the password used for the certificate.
Start the container with ASP.NET Core configured for HTTPS:
docker-compose -f "docker-compose.debug.yml" up -d
ASP.NET Core-feedback
ASP.NET Core is een open source project. Selecteer een koppeling om feedback te geven:
gebeurtenis
Power BI DataViz World Championships
14 feb, 16 - 31 mrt, 16
Met 4 kansen om in te gaan, kun je een conferentiepakket winnen en het naar de LIVE Grand Finale in Las Vegas maken
Meer informatieTraining
Leertraject
Cloudeigen apps en services maken met .NET en ASP.NET Core - Training
Maak onafhankelijk implementeerbare, zeer schaalbare en tolerante apps en services met behulp van het gratis en opensource .NET-platform. Met .NET kunt u populaire microservicetechnologie gebruiken, zoals Docker, Kubernetes, Dapr, Azure Container Registry en meer voor .NET- en ASP.NET Core-toepassingen en -services.
Certificering
Bouw end-to-end-oplossingen in Microsoft Azure om Azure Functions te maken, web-apps te implementeren en te beheren, oplossingen te ontwikkelen die gebruikmaken van Azure Storage en meer.
Documentatie
Hosten van ASP.NET Core-installatiekopieën met Docker via HTTPS
Meer informatie over het hosten van ASP.NET Core-installatiekopieën met Docker via HTTPS
Belangrijke wijziging: standaardpoort ASP.NET Core is gewijzigd van 80 in 8080 - .NET
Meer informatie over de belangrijke wijziging in containers waarbij de standaardpoort ASP.NET Core is gewijzigd van 80 naar 8080.
opdracht dotnet dev-certs - .NET CLI
Met de opdracht dotnet dev-certs wordt een zelfondertekend certificaat gegenereerd om HTTPS-gebruik in te schakelen in ontwikkeling.