服务器位于 Linux 中,但我们尝试发布 .net core 文件夹。它在 IIS 中工作正常,但在 Linux 服务器中工作不正常。我们按照以下方式将项目部署到谷歌服务器。
https://cloud.google.com/blog/products/gcp/4-ways-you-can-deploy-an-aspnet-core-app-to-gcp
尝试了 4 天。我需要将我的证书读取代码转换为 Linux 服务器模式,如下所示。
string base64str = Convert.ToBase64String(Certificate);
X509Certificate2 certificate = new X509Certificate2(baseBytes, "notasecret", X509KeyStorageFlags.Exportable);
Run Code Online (Sandbox Code Playgroud)
我们在上面的行中使用了生成签名的 url,该文件存储在 google 存储库中。
我在本地运行 docker 时遇到了同样的错误,通过指定证书和密码修复了该错误。
docker run -i -p 443:443 -e ASPNETCORE_Kestrel__Certificates__Default__Path="name_of_file.pfx" -e ASPNETCORE_Kestrel__Certificates__Default__Password="password_here"
请注意,您需要在文件名中指定正确的大小写,并使用双引号而不是单引号。不加引号也可以,但是如果文本需要转义那么会很麻烦,所以最好使用双引号。
| 归档时间: |
|
| 查看次数: |
26358 次 |
| 最近记录: |