Skip to content
This repository has been archived by the owner on Apr 11, 2020. It is now read-only.

Project configured to run with IIS instead runs with dotnet.exe #815

Open
shaunluttin opened this issue Oct 14, 2016 · 5 comments
Open

Project configured to run with IIS instead runs with dotnet.exe #815

shaunluttin opened this issue Oct 14, 2016 · 5 comments

Comments

@shaunluttin
Copy link

shaunluttin commented Oct 14, 2016

I have two xprojs in the same solution. When I run one, it runs with IIS Express as expected. When I run the other, it runs from the command line, which is unexpected. I've checked the launchSettings.json, and it seems to be the same for both.

This is the one that works as expected.

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:5909/",
      "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"
      }
    }
  }
}

This is the one that does not work as expected.

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:5909/",
      "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"
      }
    }
  }
}
@davidfowl
Copy link
Member

When you look at the "play" button in visual studio, what does it say for the project that runs dotnet.exe?

@shaunluttin
Copy link
Author

shaunluttin commented Oct 14, 2016

I'm afraid I lack such a button. In which toolbar does it exist?

When I start debugging, though, I see this:

Process: [2880] dotnet.exe

@kellypleahy
Copy link

I think he means the "Start" button.

image

@shaunluttin
Copy link
Author

shaunluttin commented Oct 14, 2016

It was in the aptly named "Standard" toolbar. Now that solves it. When choosing IIS Express, the message is.

The project doesn't know how to run the profile IIS Expres.

capture

@shaunluttin
Copy link
Author

shaunluttin commented Oct 14, 2016

Answer: http://stackoverflow.com/questions/37569112/visual-studio-2015-cant-start-iis-express

It might be a problem with how Visual Studio creates an xproj when first opening an existing .NET Core project. On opening in Visual Studio 2015, we get this xrproj.

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>
  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
  <PropertyGroup Label="Globals">
    <ProjectGuid>1b2fc342-5f98-4193-bea1-141a9bc557d9</ProjectGuid>
    <RootNamespace>2016-101DP-TreeGame-Auth</RootNamespace>
    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
    <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
  </PropertyGroup>

  <PropertyGroup>
    <SchemaVersion>2.0</SchemaVersion>
  </PropertyGroup>
  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

This is the modification that worked.

-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
+  <Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants