0

I'm taking over a project from someone who is no longer avaiable to ask how/why their prjoect works.

I have two solutions, one a MVC project and the other a Web API. The MVC project calls the separate API solution to do some validation of data. If I start up the Web API project it runs on localhost:64633. Then I need to start up the MVC project so that I can step through the code and all the way through the Web API.

Thing is that the MVC project runs on localhost:64633 as well so once I have the API running and then try to debug the MVC project I get an error "Unable to start program localhost:64633. An operation is not legal in the current state.".

How can I debug both the MVC project and Web API project at the same time?

Caverman
  • 3,371
  • 9
  • 59
  • 115
  • Does [this](https://stackoverflow.com/questions/23487640/run-two-application-on-same-port-in-visual-studio) answer your question? If so, this is a duplicate. – John H Aug 21 '18 at 17:59
  • Maybe, I'll look and see if I can find an answer from that one. – Caverman Aug 21 '18 at 18:10
  • I think it's the same situation but I can't get it work either. I went into the project properties of the API solution and gave it a different port number than the MVC solution. Still, I get the same error, just with the new port number now. If I run them individually they work on the different ports. – Caverman Aug 21 '18 at 18:23
  • Are you using Chrome by any chance? If you are, stop debugging, kill all of your Chrome.exe processes, and start debugging again. – John H Aug 21 '18 at 19:19
  • I am using Chrome but what I ended up doing is starting up the API using IE and then I started up the MVC site with Chome and it didn't give me the error. Now I'm having an issue just trying to get to one of the end points but I have a feeling it has to do with the way the original developer coded or set some settings that is the issue now. – Caverman Aug 21 '18 at 19:41
  • Yeah, I'm sure I remember there being a problem to do with Chrome for this, but I thought a patch had been released for VS that addressed it. – John H Aug 21 '18 at 19:43
  • There was. [Here's](https://developercommunity.visualstudio.com/content/problem/25008/chrome-debugging-crashes-vs-with-an-operation-is-n.html) the thread for the bug. Glad you're sorted anyway. – John H Aug 21 '18 at 19:45
  • @JohnH....the patch fixed it. I was on v15.5 and the fix was in v15.6. I updated to the latest (15.8) and tried again. Now they both pull up in Chrome. Thanks! – Caverman Aug 22 '18 at 13:30
  • I still have both projects on separate port numbers which is probably needed as well. So, the fix is probably the combination of both the different ports and the patch. – Caverman Aug 22 '18 at 13:32
  • Cool, glad it's fixed. :) – John H Aug 22 '18 at 17:45

1 Answers1

0

Run Your project using local IIS server, follow below steps for that

  1. Right click on project file choose property
  2. Go to Web tab, under the Servers header choose Local IIS
  3. Then click "Create virtual Directory" button

Do above steps to both project. please try now

Note : Run both project with in single solution, automatically debug both project at a time.(Just suggestion only)

Abiuth Arun
  • 169
  • 1
  • 4