开发者

How to make a .net web application run as the root application in Visual Studio

I've been converting some .net "Web Sites" to "Web Applications". This has been going along smoothly. One of the steps that I perform each time I do a conversion is I go to the web section of the project properties and set the virtual directory.

So far, I've set up

-http://localhost/site1

-http://localhost/site2

-http://localhost/site3

Finally, I've received the task of performing a Web Site -> Web Application conve开发者_JAVA技巧rsion on the web site that resides on the root directory of our servers. However, if I specify http://localhost/ as the virtual directory in Visual Studio, it results in an error. How do I go about converting the root web site to a web application project in Visual Studio?


This feels like a KLUDGE, but I've found a way to do what I want.

First, open the Web settings tab of the project properties in Visual Studio. Set the virtual directory to http://localhost/someDirectory. You cannot set it to http://localhost/ at this point as an error will result. Build your web site to the directory (on disk) where you want to host it from.

Next, open the .proj file in notepad and find http://localhost/someDirectory; change it to http://localhost.

Now, go in to your IIS settings and change the home directory of your web site to the directory where the web site is built on the disk.

Finally, open the project in Visual Studio again. Go to the web settings tab of the project properties and see that it is set to use the virtual directory http://localhost/.


To set your root directory go into IIS and right click the "Default Web Site" go to properties --> "Home Directory" and set "Local Path" to the directory of your root website. Then whenever you type http://localhost/ it will point to that website.
I'm unsure about how this will effect your other sites though.

Let me know if this works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜