如何使.net Web应用程序作为Visual Studio中的根应用程序运行

Dan*_*don 7 iis web-applications virtual-directory visual-studio web

我一直在将一些.net"网站"转换为"Web应用程序".这一直顺利进行.我每次执行转换时执行的其中一个步骤是转到项目属性的Web部分并设置虚拟目录.

到目前为止,我已经设置了
- http:// localhost/site1
- http:// localhost/site2
- http:// localhost/site3

最后,我收到了在网站上执行网站 - > Web应用程序转换的任务,该网站位于我们服务器的根目录中.但是,如果我将http:// localhost /指定为Visual Studio中的虚拟目录,则会导致错误.如何在Visual Studio中将根网站转换为Web应用程序项目?

Dan*_*don 7

感觉就像一个KLUDGE,但我找到了一种方法来做我想要的.

首先,在Visual Studio中打开项目属性的Web设置选项卡.将虚拟目录设置为http://localhost/someDirectory.此时无法将其设置为http://localhost/,因为将导致错误.将您的网站构建到您要从中托管的目录(在磁盘上).

接下来,在记事本中打开.proj文件并查找http://localhost/someDirectory; 改为http://localhost.

现在,进入IIS设置并将网站的主目录更改为磁盘上构建网站的目录.

最后,再次在Visual Studio中打开该项目.转到项目属性的Web设置选项卡,并查看它是否设置为使用虚拟目录http://localhost/.


Gag*_*age 6

要设置根目录进入IIS并右键单击"默认网站",转到属性 - > "主目录",并将"本地路径"设置为根网站的目录.然后,无论何时键入http:// localhost /,它都将指向该网站.
我不确定这将如何影响你的其他网站.

让我知道这个是否奏效.