IronSecureDoc 教程 使用 HTTPS 在 C# 中使用 HTTPS,方法是使用证书运行容器。 Curtis Chau 已更新:六月 1, 2025 下载 IronSecureDoc 免费下载 免费试用 法学硕士副本 法学硕士副本 将页面复制为 Markdown 格式,用于 LLMs 在 ChatGPT 中打开 向 ChatGPT 咨询此页面 在双子座打开 向 Gemini 询问此页面 在双子座打开 向 Gemini 询问此页面 打开困惑 向 Perplexity 询问有关此页面的信息 分享 在 Facebook 上分享 分享到 X(Twitter) 在 LinkedIn 上分享 复制链接 电子邮件文章 This article was translated from English: Does it need improvement? Translated View the article in English 如果需要使用证书运行容器,请按照以下步骤生成证书并配置本地计算机: 使用证书运行 IronSecureDoc 容器 1.生成证书: # Generates a new HTTPS certificate for use with ASP.NET Core. # Saves the certificate at the specified path and protects it with a password. dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -p <CREDENTIAL_PLACEHOLDER> # Trusts the generated certificate on your local machine. dotnet dev-certs https --trust # Generates a new HTTPS certificate for use with ASP.NET Core. # Saves the certificate at the specified path and protects it with a password. dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -p <CREDENTIAL_PLACEHOLDER> # Trusts the generated certificate on your local machine. dotnet dev-certs https --trust SHELL 代替<CREDENTIAL_PLACEHOLDER>使用密码。 2.运行 Docker 容器: # Runs the IronSecureDoc Docker container with both HTTP and HTTPS ports exposed. docker container run -d \ -p 8081:8081 -p 8080:8080 \ # Maps container ports to host ports for HTTP and HTTPS. -e HTTP_PORTS=8080 \ # Sets the HTTP port for the application. -e HTTPS_PORTS=8081 \ # Sets the HTTPS port for the application. -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> \ # Provides the IronSecureDoc license key. -e ENVIRONMENT=Production \ # Configures the environment as Production. -v %USERPROFILE%\.aspnet\https:/https:ro \ # Mounts the directory to the container as read-only. -e CERTIFICATE_PATH=%USERPROFILE%\.aspnet\https\ironsecuredoc.pfx \ # Specifies the path to the certificate in the container. -e CERTIFICATE_PASSWORD=<CERTIFICATE_PASSWORD> \ # Password for the certificate. ironsoftwareofficial/ironsecuredoc:latest # Specifies the Docker image to use. # Runs the IronSecureDoc Docker container with both HTTP and HTTPS ports exposed. docker container run -d \ -p 8081:8081 -p 8080:8080 \ # Maps container ports to host ports for HTTP and HTTPS. -e HTTP_PORTS=8080 \ # Sets the HTTP port for the application. -e HTTPS_PORTS=8081 \ # Sets the HTTPS port for the application. -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> \ # Provides the IronSecureDoc license key. -e ENVIRONMENT=Production \ # Configures the environment as Production. -v %USERPROFILE%\.aspnet\https:/https:ro \ # Mounts the directory to the container as read-only. -e CERTIFICATE_PATH=%USERPROFILE%\.aspnet\https\ironsecuredoc.pfx \ # Specifies the path to the certificate in the container. -e CERTIFICATE_PASSWORD=<CERTIFICATE_PASSWORD> \ # Password for the certificate. ironsoftwareofficial/ironsecuredoc:latest # Specifies the Docker image to use. SHELL 代替<IRONSECUREDOC_LICENSE_KEY>和<CERTIFICATE_PASSWORD>分别使用您的 IronSecureDoc 许可证密钥和证书密码。 常见问题解答 为什么 HTTPS 对文档安全很重要? HTTPS 对文档安全至关重要,因为它加密了传输的数据,确保敏感信息在传输过程中保持机密并防止拦截。 如何为我的应用程序创建 HTTPS 证书? 您可以通过运行命令dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -p <CREDENTIAL_PLACEHOLDER>创建 HTTPS 证书,该命令生成用于 ASP.NET Core 的新证书。 怎样确保我的 HTTPS 证书在本地机器上被信任? 要在本地机器上信任您的 HTTPS 证书,使用命令dotnet dev-certs https --trust。此命令将您的系统配置为信任生成的证书。 运行支持 HTTPS 的 Docker 容器的过程是什么? 要运行支持 HTTPS 的 Docker 容器,开放 HTTP 和 HTTPS 端口,设置必要的环境变量如IronSecureDoc_LicenseKey和CERTIFICATE_PASSWORD,并将证书目录挂载为只读。 在 Docker 设置中应该配置哪些端口以支持 HTTPS? 在 Docker 设置中进行 HTTPS 配置,通过暴露端口 8081 作 HTTPS 和端口 8080 作 HTTP ,将容器端口映射到主机端口。 如何将证书密码传递给 Docker 容器? 在执行 Docker run 命令时,使用环境变量CERTIFICATE_PASSWORD将证书密码传递给 Docker 容器。 在 Docker 中配置为 "Production" 环境需要哪些步骤? 要在 Docker 中配置为“Production”环境,在您的 Docker run 命令中设置环境变量ENVIRONMENT=Production。 在 Docker 命令中如何处理占位符? 在 Docker 命令中,用您的实际 IronSecureDoc 许可证密钥和证书密码替换占位符如<IRONSECUREDOC_LICENSE_KEY>和<CERTIFICATE_PASSWORD>以确保正常功能。 Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? Version: 2024.10 刚刚发布 免费下载 查看许可证