开发者

How to setup IIS Express to run a Visual Studio project in a Virtual Directory instead of root?

I'm using VS 2010 and a using IIS Express instead of the Visual Studio's web server.

By default the Web application runs at the root of localhost something like this: http://localhost:50369/

I wish it to run at http://localhost:50369/Enet/ instead as this is the virtual directory it will end up at when published.

When I tried to add the virtual directory my applicationhost.config looked this this:

<site name="EssenceNet" id="1">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="E:\dev\EssenceNet\Src\EssenceNet.Web" />
                </application>
                <application path="/ENet">
                    <virtualDirectory path="/" physicalPath="E:\dev\EssenceNet\Src\EssenceNet.Web" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation=":50369:localhost" />
                </bindings>
            </site>

When I browse to http://localhost:50369/ my application works. When I browse to http://localhost:50369/Enet/ my MVC application works, but it can't find files like CSS or JS files. The paths for them are what I'd expect (the same as before except prefixed with /Enet) but they're not found.

What are the steps to do this correctly? Obviously I've gon开发者_JAVA技巧e wrong somewhere. Thanks very much for any help.


It turns out my config is almost correct but that the applications need to be different physical paths.

It seems you do need that 1st application at root even if you don't use it. I just set its physical path to be something other than that of /ENet's and it worked.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜