运行在一个Visual Studio开发服务器的多个Web应用程序? [英] Run multiple web applications in one Visual Studio development server?
问题描述
我有两个ASP.Net MVC的Web应用程序,ParentSite和ChidSite。 ParentSite有一个页面,这将打开一个弹出窗口,这将导航到子站点,当childpage完成它通知父页面。但是我得到跨域误差
I have 2 ASP.Net MVC web application, ParentSite and ChidSite. ParentSite has a page which will open a pop-up window which will navigate to child site, when childpage is done it notifies the parent page. However I'm getting a cross domain error as
Parent is = http://localhost:49000/Home
Child is = http://localhost:50000/Home
有没有在Visual Studio的方式,我可以在Visual Studio开发服务器在一个端口上同时运行Web应用程序(而不是在本地IIS服务器)。
Is there a way in Visual Studio where I can run both the web application under one port in Visual Studio development server ( NOT ON LOCAL IIS SERVER ).
如果我们使用相同的端口项目时,Visual Studio automatcally选择一个动态端口,如果已经有在其上运行开发服务器。
If we use the same-port in the project, Visual Studio automatcally chooses a dynamic port if there is already DEV server running on it.
感谢您的帮助。
推荐答案
没有,你不能承载相同的端口/应用空间下的两个应用程序。想想之类的东西web.config中,路由(如在评论中提到的),安全性等这些都是空间的组成部分。
No, you can't host two applications under the same port/application space. Think of things like web.config, routing (as mentioned in the comments), security, etc. Those are all part of that space.
您可以尝试解决跨域错误,但是这并不简单,是不是跨浏览器友好的(还)。我希望的变化。
You could try to solve the cross-domain errors, but this isn't straightforward and isn't cross-browser friendly (yet). I hope that changes.
您有几个选项:
- 会使您需要在ChildSite用的WebAPI和控制器从ParentSite消耗它的位。你可以用简单的HTTP得到做到这一点,并返回JSON来弹出(现在就住在ParentSite)。客户端不再访问第三方网站。
- 使用领域或便携式领域,以纳入儿童计划到ParentSite
要添加在解决方案资源管理你的MVC项目区只需右键单击并选择添加 - >区域
To add areas simply right-click on your MVC project in Solution Explorer and select Add -> Area.
干杯。
这篇关于运行在一个Visual Studio开发服务器的多个Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!