在调试中为SSL配置launchSettings.json-ASP.NET Core/Visual Studio代码 [英] Configure launchSettings.json for SSL in debug - ASP.NET Core / Visual Studio Code

查看:60
本文介绍了在调试中为SSL配置launchSettings.json-ASP.NET Core/Visual Studio代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照教程进行操作将Facebook身份验证添加到我的Web应用程序.

I am following this tutorial to add Facebook authentication to my web app.

作为该过程的一部分,我试图在我的项目上启用SSL,但是我发现的所有事情都涉及更新Visual Studio的项目属性"对话框中的设置,该设置对我来说是无法通过Mac上的Visual Studio Code获得的.我尝试过手动更新launchSettings.json中的值,但是我没有任何运气.

As part of the process I am trying to enable SSL on my project but everything I have found involves updating a setting in the Project Properties dialog in Visual Studio, which is unavailable to me through Visual Studio Code on my Mac. I've tried updating the values in launchSettings.json manually, but I haven't had any luck.

如何在Visual Studio Code中更新launchSettings.json(或其他项目文件)以在调试时启用SSL?

How do I update launchSettings.json (or other project files) in Visual Studio Code to enable SSL while debugging?

推荐答案

如果不想仅为了在VS Code中进行调试而更改Program.cs文件,还可以在launch.json中配置url.您需要在env属性中指定网址.正如xneg所说,您需要设置一个自签名证书才能做到这一点.

If you don't want to change your Program.cs file just for debugging in VS Code, you can also configure the urls in your launch.json. You need to specify the urls in the env property. As xneg said you'll need to set up a self-signed cert to do this.

您可以配置http网址和https(SSL)网址

You can configure the http url and the https (SSL) url

"configurations":[
    {
        ...
        "env": {
            "ASPNETCORE_ENVIRONMENT": "Development",
            "ASPNETCORE_URLS": "http://localhost:5002;https://localhost:5003"
        },
        ...
    }

文档对于Kestrel 有助于解决这一问题.

The documentation for Kestrel was helpful in figuring this out.

这篇关于在调试中为SSL配置launchSettings.json-ASP.NET Core/Visual Studio代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆