首页 文章

尝试配置ASP.NET 5项目时,“IIS Express设置缺少App Url属性”

提问于
浏览
2

我下载了一个示例ASP.NET 5(vNext)应用程序,并尝试将其配置为在我的本地计算机上运行 .

当我打开Project Properties窗口并切换到Debug选项卡时,App URL字段为空,无法编辑:

Empty App URL field

当我尝试从IIS Express更改为 web 配置文件,甚至关闭“属性”窗口时,出现此错误:

IIS Express error

IIS Express设置缺少App URL属性 . 这是配置IIS express以运行站点所必需的 .

此时,Visual Studio完全卡住了,甚至都不会退出 . 我不得不通过任务管理器终止这个过程 .

如果字段被锁定,如何设置此属性?

3 回答

  • 1

    该项目缺少 Properties\launchSettings.json 中的 iisSettings 部分 .

    original launchSettings.json

    {
      "profiles": {
        "IIS Express": {
          "commandName": "IISExpress",
          "launchBrowser": true,
          "environmentVariables": {
            "ASPNET_ENV": "Development"
          }
        },
        "web": {
          "commandName": "web",
          "environmentVariables": {
            "ASPNET_ENV": "Development"
          },
          "sdkVersion": "dnx-clr-win-x86.1.0.0-rc1-final"
        }
      }
    }
    

    我不得不在 profiles 上面添加这一部分:

    "iisSettings": {
      "windowsAuthentication": false,
      "anonymousAuthentication": true,
      "iisExpress": {
          "applicationUrl": "http://localhost:49901/",
          "sslPort": 0
      }
    }
    

    添加后,我可以通过“属性”窗口正常修改设置 .

  • 3

    我无法解释为什么你不能在Visual Studio中对App URL进行必要的更改,但我建议你使用一些文本编辑器来更改设置 .

    查看项目目录的子目录 Properties 并检查文件 launchSettings.json . 您将找到带有应用URL的 iisSettings.iisExpress.applicationUrl . 您只需编辑或将属性包含在文件 launchSettings.json 中即可 . 有关详细信息,请参阅the documentation .

  • 0

    对于同样的错误在我的情况下“IIS Express”部分以某种方式被破坏 . 我从Source Control恢复了launchSettings.json

相关问题