【问题标题】:VS 2013 / IIS Express - serve site from localhost:port/myapp instead of localhost:portVS 2013 / IIS Express - 从 localhost:port/myapp 而不是 localhost:port 服务站点
【发布时间】:2014-09-17 08:03:48
【问题描述】:

在产品中,我的网站 (mvc5) 托管在 https://company.no/myApp/ 上,其中 myApp 是 IIS 上的应用程序。

在开发中,我的网站托管在 http://localhost:54307/ 上的 IIS Express 上

由于这会导致服务器相对路径出现问题,我还想在 http://localhost:54307/myApp 上进行调试。

这是我尝试过的:

  • 将属性页中的项目 url 设置为 http://localhost:54307/myApp 并单击创建虚拟目录
  • 尝试使用或不使用 myApp url 覆盖应用程序根目录。
  • 尝试修改 applicationhost.config。目前我的设置如下所示:

      <site name="MyApp.Web-Site" id="38">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\Projects\OP\MyApp\Main\src\MyApp.Web" />
            </application>
            <application path="/MyApp" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\Projects\OP\MyApp\Main\src\MyApp.Web" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:54307:localhost" />
                <binding protocol="https" bindingInformation="*:44307:localhost" />
            </bindings>
        </site>
    

当我尝试从 myApp 文件夹打开页面时,出现以下错误:

 Module    IIS Web Core
 Notification      BeginRequest
 Handler       Not yet determined
 Error Code    0x800700b7
 Config Error      Cannot add duplicate collection entry of type 'add' with unique key attribute      'name' set to 'WSFederationAuthenticationModule'
 Config File       \\?\C:\Projects\OP\MyApp\Main\src\MyApp.Web\web.config
 Requested URL     http://localhost:54307/MyApp
 Physical Path     C:\Projects\OP\MyApp\Main\src\MyApp.Web

这表示 web.config 加载了两次。知道我做错了什么吗?

感谢您的帮助

拉西

【问题讨论】:

    标签: asp.net asp.net-mvc iis visual-studio-2013 iis-express


    【解决方案1】:

    听说您使用 IIS Express 会导致服务器相对路径出现问题。您可以通过几个不包括手动编辑 applicationhost.config 的步骤来设置它。我尽量避免手动编辑 applicationhost.config,它似乎导致的问题多于解决的问题。我会从您的本地 IIS 中删除该网站以清除所有这些内容,然后执行以下步骤:

    • 右键单击您的 Web 项目并选择属性。
    • 点击“Web”菜单
    • 将下拉菜单更改为本地 IIS 并输入您希望应用解析的 URL,然后单击创建虚拟目录,保存文件并构建。
    • 您仍然可以在没有端口号的情况下进行调试,只要您在 Web 选项卡上选中了调试器选项,调试器就会附加到您本地 IIS 实例中的这个新网站。
    • 打开本地 IIS 并进行应用运行所需的任何其他配置(身份验证、应用程序池等)。
    • 打开浏览器并导航到http://localhost/YourAppName
    • 由于就您的本地 iis 而言,这是一个网站,您可以随时在浏览器中点击它,而无需运行 Visual Studio。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多