Starting .Net web service on the same port as the ASP.Net application

女生的网名这么多〃 提交于 2019-12-22 04:37:18

问题


We have a simple Visual Studio solution containing 2 projects:

  • A.) Simple ASP.Net website
  • B.) RESTful web service hosted in another ASP.Net application

We want to simply start the projects in Debug mode (F5) and have A consume data from B through Ajax. We do not have the possibility to configure IIS on all development machines (because some of them are on the client's side). The problem might be that JavaScript needs to be in the same domain as the URL it posts to.

Is there any way we can use Visual Studio 2010 Development Server to start both applications simultaneously in debug mode on the same port?

If this is not possible, what is the next best thing you can recommend?


回答1:


We solved this problem by installing IIS on the development workstation. In each Visual Studio project, on the Web property page, select Use Local IIS Web server. Do not check Use IIS Express. The Project URLs will be set to http:localhost/<projectname> (note: in the same domain). You’ll be prompted to Create a Virtual Directory for each. Each will be assigned to the default IIS app pool. Open the Internet Information Services (IIS) Manager. Click Application Pools on the left pane. On the right pane add another integrated application pool. For one of the applications, open the Advanced Settings... In the properties view select the app pool you just created as the application pool. The applications should be debuggable in parallel because each Application Pool spawns a new operating system process to which a separate debugger can be attached.




回答2:


Yo won't be able to host different apps on the same port within a Cassini instance, there are tools that might be useful but I would leave Cassini host them on different ports which is its regular behavior.

Options are (not tested):

UltiDev

Cassini Extesion

By the way, not sure if you know this, but to start both projects go to Set startup projects, there's an option on the Solution context menu.



来源:https://stackoverflow.com/questions/11563064/starting-net-web-service-on-the-same-port-as-the-asp-net-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!