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

2

7

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?

Layton answered 19/7, 2012 at 14:30 Comment(2)
what is the problem you are seeing? on different ports they'll share the same domain: localhostJyoti
Different port is considered a different domain en.wikipedia.org/wiki/Same_origin_policyLayton
M
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.

Mentor answered 13/2, 2013 at 23:2 Comment(1)
-1: The OP said, " We do not have the possibility to configure IIS on all development machines (because some of them are on the client's side)."Mange
M
0

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.

Matta answered 19/7, 2012 at 15:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.