在 IISExpress 中使用自定义 URL 作为基础 URL

Use custom URL in IISExpress as Base URL

我有一个使用 IISExpress 的项目。 假设网站项目的名称是:AdventureWorks

当我在 VS 中 运行 应用程序时,它将转到 http://localhost:12345/

但我希望它使用网站项目作为基础URL,所以例如:http://localhost:12345/AdventureWorks

我尝试在项目 属性 中设置 Pages > Server > User custom server > Base URL : http://localhost:12345/AdventureWorks

不过好像不行。我收到以下错误消息:

有什么想法吗?

我通过编辑 applicationhost.config 做了一些解决方法。这里有2种applicationhost.config,一种在C:\Users\[Username]\Documents\IISExpress\config中,一种在项目中.vs\config。显然,此解决方案中使用了 .vs\config 并且我添加了:

<virtualDirectory path="/AdventureWorks" physicalPath="D:\Codes\AdventureWorks\trunk\Project\AdventureWorks" />

这样它也会映射 AdventureWorks 的位置。