如何在同一个 IIS Express 实例上提供两个 ASP.Net MVC 应用程序?
我有两个 ASP.Net MVC 应用程序,例如 Site1 和 Site2。
现在,我可以通过访问 http://localhost/
成功访问 Site1
这是我的 IIS Express applicationhost.config 文件:
<sites>
<site name="Site1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_USER_HOME%\wwwroot\Site1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:localhost" />
<binding protocol="http" bindingInformation=":80:10.49.0.137" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\logs\tracelogfiles" enabled="false" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="IISExpressAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
我现在想要什么是:
- 在
http://localhost/Site1
上访问 Site1 - 将 Site2 放在
%IIS_USER_HOME%\wwwroot\Site2
上 - 在
http.//localhost/Site2
上访问 Site2
我应该如何更改上面的 applicationhost.config 来实现我想要的?
谢谢。
I have two ASP.Net MVC applications, let's say Site1 and Site2.
For now, I can successfully access Site1 by visiting http://localhost/
Here's my IIS Express applicationhost.config file:
<sites>
<site name="Site1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_USER_HOME%\wwwroot\Site1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:localhost" />
<binding protocol="http" bindingInformation=":80:10.49.0.137" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\logs\tracelogfiles" enabled="false" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="IISExpressAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
What I want now is:
- Access Site1 on
http://localhost/Site1
- Place Site2 on
%IIS_USER_HOME%\wwwroot\Site2
- Access Site2 on
http.//localhost/Site2
How should I change the above applicationhost.config to achieve what I want?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如下所示更改 applicationhost.config 并重新启动 IIS Express。
change your applicationhost.config as shown below and restart IIS Express.
检查这个很棒的条目。
在开发时使用 SSL使用 IISExpress 更容易 - Scott Hanselman
在 applicationHost.config 追加绑定后执行 netsh 命令。
Check this great entry.
Working with SSL at Development Time is easier with IISExpress - Scott Hanselman
Execute netsh command after applicationHost.config append binding.