I would like to run my API using dotnet run
, so I can run some tests against it. However, on Azure Pipelines and AppVeyor, they don't have a developer certificate installed and I get an error when I try to start my API. Installing a developer certificate involes running:
dotnet dev-certs https --trust
However, this shows a dialogue which the user has to click and this fails the build. How can I install the developer certificate on a CI server?
The dotnet dev-certs command manages a self-signed certificate to enable HTTPS use in local web app development. Its main functions are: Generating a certificate for use with HTTPS endpoints during development. Trusting the generated certificate on the local machine.
Can I configure my app to require a certificate only on certain paths? This isn't possible. Remember the certificate exchange is done at the start of the HTTPS conversation, it's done by the server before the first request is received on that connection so it's not possible to scope based on any request fields.
When we create a web application with Visual Studio, we have an option to configure our application for HTTPS. When we create the application using CLI, by default, the web application configures for HTTPS. Using the following command, we can turn off HTTPS.
You can either use your own certificate (aspnet core listenOptions.UseHttps (new X509Certificate2 (...));) in your app or export the dotnet dev certificate with: dotnet dev-certs https --export-path <path> [--password <pass>] This generates the certificate that you need. You can trust this certificate manually with powershell as explained here:
On the IIS Manager at the server level, locate the “Server Certificates” icon and double-click it Locate the “Actions” pane on the ride side and click “Import” Provide the .pfx file full path, password for the keys and click OK. This will install the certificate for you. You must be a registered user to add a comment.
The dotnet dev-certs command manages a self-signed certificate to enable HTTPS use in local web app development. Its main functions are: Generating a certificate for use with HTTPS endpoints during development. Trusting the generated certificate on the local machine. Removing the generated certificate from the local machine.
How to install SSL certificate on the Windows Server. Login to your server with the Username and Password. Select the Server name in the left window pane. Double click on Server Certificates in the right window pane. Click on Certificate Service Request. Fill the details in the request certificate. Click on Next
You can either use your own certificate (aspnet core listenOptions.UseHttps(new X509Certificate2(...));
) in your app or export the dotnet dev certificate with:
dotnet dev-certs https --export-path <path> [--password <pass>]
This generates the certificate that you need. You can trust this certificate manually with powershell as explained here:
https://stackoverflow.com/a/49444664/1216595 or https://stackoverflow.com/a/21001534/1216595
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With