0

I am trying to run a specific Web Project in a way to receive requests from an external application.

So when pressing F5 it starts the current Web project in visual studio with debugging but waits from the other site for web calls.

The problem is that for the other web site to work i have to launch several other sites, with services, resources, auth server etc. Some are not part of the solution - which means I cannot use "Always launch when debugging".

For that I have the executable that you can see grayed out in the "Start external program" section. The "IISExpressRunner". This program will also open the site that will access this one after everything is setup.

Project properties Web

My problem is that I currently need to run that manually every time I start debugging because both options cannot be selected at the same time - which of course does not make sense since it can debug only one thing.

I can debug the WebSite via the IISExpressRunner application alone, however that has the implication that I need to run VS in Administrator mode, since the app requests UAC to be able to disable IIS to run IISExpress on port 80 - specific for domain alias and authentication server redirects for Google and Facebook logins - to be able to run it locally in the dev environment.

So is there a way to have Visual Studio debug the current project and automatically after debug has started to also execute this external application without debugging it?

Boas Enkler
  • 12,264
  • 16
  • 69
  • 143
Marino Šimić
  • 7,318
  • 1
  • 31
  • 61
  • 1
    See if you can use the [Post Build Scripts](https://msdn.microsoft.com/en-us/library/ke5z92ks.aspx) for that. – Mat J Oct 14 '16 at 06:05

2 Answers2

1

A workaround I could think of is that you could call the bat file before you debugging the app using code "Debugger.IsAttached()".

Run batch script before Debugging

Community
  • 1
  • 1
Jack Zhai
  • 6,230
  • 1
  • 12
  • 20
  • I would avoid something that is csproj.user specific to go into the project code (and it would need to be in the startup of each project I would want to debug). – Marino Šimić Oct 28 '16 at 16:48
  • I don't find one solution directly, like my previous suggestion, I just know that you could edit the code and debug what you want to debug, for example, using the #if DEBUG or others. – Jack Zhai Oct 31 '16 at 11:22
0

There is a manual process you can use. During running a debugging session, right-click the project you want to also start debugging, go to the Debug submenu, and click Start New Instance.

A.Konzel
  • 1,920
  • 1
  • 13
  • 14
  • This would make it really weird. The runner would need to launch the services without the one being debugged and when the browser opens it would start the web portal main page that would not work if the programmer did not start debugging fast enough in visual studio. - might or might not work with a refresh afterwards, depending if there was some redirect on the pages. I am happier with launching visual studio in admin mode than having non working F5 launches. – Marino Šimić Oct 13 '16 at 19:35