aspnet / Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
Other
256 stars 124 forks source link

Not able to run multiple ASP.Net Core projects after setting them as multiple Startup projects in VS #797

Open DreamingDevs opened 7 years ago

DreamingDevs commented 7 years ago

Steps to reproduce

Create two ASP.Net Core Projects under same solution using VS. Select multiple Startup projects (by right clicking VS Solution file -> Properties -> Multiple Startup projects). For both the projects, select the action as Start.

Actual behavior

Only the first ASP.Net Core project is started.

Expected behavior

Both the ASP.Net Core Projects should be started.

Environment data

.NET Command Line Tools (1.0.0-preview2-003131)

Product Information:
 Version:            1.0.0-preview2-003131
 Commit SHA-1 hash:  635cf40e58

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 RID:         win10-x64

I used Visual Studio Community 2015 Version 14.0.25425.01 Update 3.

I have installed Visual Studio 2015 Tooling Preview 2 of version DotNetCore.1.0.1 - VS2015Tools.Preview2.0.2 from https://go.microsoft.com/fwlink/?LinkId=827546

OS - Windows 10 Enterprise N

mlorbetske commented 7 years ago

TFS Bug#273275

BillHiebert commented 7 years ago

@DreamingDevs - I can't reproduce this. Are you running IIS Express or Kestrel? If using Kestrel, can you make sure they are running on different ports? It is possible the second one failed to start because the ports collided - though I would expect the debugger to stop at that point.

DreamingDevs commented 7 years ago

@BillHiebert I am trying to run on IIS Express (for both Web projects I have Debug profile set to IIS Express).

I also even tried by setting Debug profiles to corresponding Kestrel commands (both projects ports are differently - 5000 and 5001). When I did F5, I still have only one project got executed (WebApplication1). Here interesting fact is that the project which got opened up in the browser is holding IIS Express configured port.

For your reference I am including launchsettings.json and startup.cs for both projects.

launchSettings.json of WebApplication1 -

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:58972/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "WebApplication1": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

launchSettings.json of WebApplication2 -

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:59015/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "WebApplication2": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "http://localhost:5001",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

Program.cs holds default code for both projects.

        public static void Main(string[] args)
        {
            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup<Startup>()
                .Build();

            host.Run();
        }

Startup.cs also holds default code.

masterjs commented 7 years ago

Hello, 4 months later, with VS 2017 & using .csproj, I also can't find a way to make this work with IIS Express. Is this still a known issue? My case is that I have 2 sites, one with WebApi/Swagger and another whom is the "admin site" handling the configurations. I always have to stop everything when I want to switch to the other site.

thank you, JS

v1sion commented 7 years ago

@masterjs i have exactly the same problem. Did you found a solution? Thank you ;)

masterjs commented 7 years ago

@andremmorais nope. sadly nothing. The only "workaround" I though of is to have the 2 VS opened for the same solution and then it will be possible.

v1sion commented 7 years ago

One possible solution can be do the publishing of the projects to your machine, creating the sites in the iis and in the pools of the sites changing it to unmanaged code if I'm not mistaken. And then run the projets on the browser and go to the attach to process and attach the process you want to debug on visual studio.Is ugly solution and not pratical but it works xDv

masterjs commented 7 years ago

@DreamingDevs with VS 2017 15.3 (preview 6) it is now supported properly. I use it for my projects 1.1 and it really stable.