如何在Visual Studio 2017 Web Proj ASP.NET Core 2.0中禁用Https

问题描述:

我已在Visual Studio 2017中使用ASP.NET Core 2.0创建了一个默认项目.我选择了带有MVC和个人使用身份验证"的Web应用程序.默认情况下,它正在配置并使用https.我尝试通过进入项目属性并删除用户ssl并将https更改为http来禁用该功能,但随后出现IIS Express Connection错误或404.

I've created a default project in Visual Studio 2017 with ASP.NET Core 2.0. I've chosen the Web App with MVC and with Individual Use Auth. By default, it is coming up configured and working with https. I've tried disabling that by going into project properties and removing the user ssl and changing https to http but then I get either and IIS Express Connection error or a 404.

我之前没有看到默认的https.那是哪里来的,我应该在哪里禁用它?

I've not see default https before. Where is that coming from and where can I disable it?

我刚刚使用Net Core 2.0创建了默认的MVC应用.

I've just created a default MVC app using net core 2.0.

要禁用SSL,您需要执行2个步骤.您可以通过使用Visual Studio GUI或编辑launchsettings.json(进一步向下)来完成此操作

To disable SSL, you need to do 2 steps. You can do this either by using the Visual Studio GUI, or by editing the launchsettings.json (further down)

  • 转到您的项目属性
  • 取消选中SSL选项
  • 将应用程序网址复制到开始"浏览器输入中
  • go to your project properties
  • Uncheck the SSL option
  • Copy the App Url over to the Start browser input

瞧,

如果您不喜欢使用该界面,则可以通过设置sslPort: 0"launchUrl": "http://localhost:13121/"(或您要启动该应用程序的任何位置)来编辑launchsettings.json文件.

If you are not a fan of using the interface, you can alternatively edit the launchsettings.json file, by setting sslPort: 0 and "launchUrl": "http://localhost:13121/" (or where ever you want to launch the application)

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:13121/",
      "sslPort": 0 
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "http://localhost:13121/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "WebApplication1": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:13122/"
    }
  }
}