C
C#12mo ago
Leno

Self-signed SSL certificate for application development

How can I configure a self-signed SSL certificate for application development? When I run the application in Visual Studio, it works with HTTPS on the port defined in launchSettings.json. However, after navigating to /bin/Debug/net8.0 and running the .exe, the application doesn't work the same way. Unlike when running in vs, it runs on port 5000 and uses HTTP. (ASP.NET Core Web API)
3 Replies
Jimmacle
Jimmacle12mo ago
dotnet dev-certs command - .NET CLI
The dotnet dev-certs command generates a self-signed certificate to enable HTTPS use in development.
Leno
LenoOP12mo ago
How to correctly use the generated certificate? I've tried various solutions, and none of them have worked appsettings.json
//...
"Kestrel": {
"EndPoints": {
//"HttpsInlineCertAndKeyFile": {
// "Url": "https://localhost:8443",
// "Certificate": {
// "Path": "./localhost.pem",
// "KeyPath": "./localhost-key.pem"
// }
//},
//"HttpsDefaultCert": {
// "Url": "https://localhost:5004"
//},
"HttpsInlineCertFile": {
"Url": "https://localhost:8443",
"Certificate": {
"Path": "./certificate.pfx",
"Password": "password"
}
}
}
}
//...
"Kestrel": {
"EndPoints": {
//"HttpsInlineCertAndKeyFile": {
// "Url": "https://localhost:8443",
// "Certificate": {
// "Path": "./localhost.pem",
// "KeyPath": "./localhost-key.pem"
// }
//},
//"HttpsDefaultCert": {
// "Url": "https://localhost:5004"
//},
"HttpsInlineCertFile": {
"Url": "https://localhost:8443",
"Certificate": {
"Path": "./certificate.pfx",
"Password": "password"
}
}
}
}
Leno
LenoOP12mo ago
error
No description
Want results from more Discord servers?
Add your server