How to configure a different virtual directory for web site project with Visual Studio 2015

我是研究僧i 提交于 2019-12-01 21:34:10
costa

Having the following configuration made it work, i.e. http://localhost:59903/myapp works now as well as http://localhost:59903.

<site name="My Web Application" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\costa\Documents\webapps\My Web Application" />
    </application>
    <application path="/myapp" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\costa\Documents\webapps\My Web Application" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:59903:localhost" />
    </bindings>
</site>

Note the presence of two application elements.

See this as well: IIS7: Possible causes of 'Unrecognized configuration path' error

There has a way that you don't need to modify the configuration file which is much easier. And this is the answer from Microsoft.

  1. In Visual Studio, on the File menu, click Open and then click Web Site.
  2. In the dialog box, click the Local IIS icon.
  3. In the top-right corner of the dialog box, click the Create New Virtual Directory button.
  4. In the Alias name text box, type the name for your virtual directory.
  5. In the Folder text box, type the fully qualified path to the physical directory where your files are located, or click the Browse button to browse to the location, and then click OK

That's it, you will be happy to see this result in your project.

https://msdn.microsoft.com/en-us/library/d6cw6cfs.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!