1

One of the comfort benefits of hosting a development version of a web application on the developer's client machine is the ease of which a change can be verified.

In a traditional ASP.NET web application I'll usually have this setup: The IIS site or IIS web application has its physical path pointing to the ASP.NET web application's project path.

This enables me to do a change, recompile if necessary, and hit refresh in the browser to instantly see the effects of my change.

Now, if I wanted to I could have IIS point to a different path and publish the ASP.NET web application to that location with each change, a far more cumbersome process.

I prefer the in-place IIS setup for faster turn-around, and I would like the same setup for ASP.NET Core, but I've not figured out how. As far as I can tell, I can at least do the following:

  • Start the debugger in VS (IIS Express or dotnet.exe)
  • Run the web application from the console
  • Publish the changes to a different physical path that is mapped to by an IIS site/web application.

Both these options work, but circumstances conspire to make the result difficult to manage: I usually work on both the client and the service, and the client frequently involves multiple service web applications. So I will typically need to have multiple web applications running at the same time, and need to update these frequently.

While IIS provides this opportunity in my classic ASP.NET applications, I'm not dead set on continuing to use it. Any other method to achieve smooth turn-around would be acceptable :)

So, any tips?

-S

Sigurd Garshol
  • 1,376
  • 3
  • 15
  • 36
  • is running `dotnet publish` really so cumbersome? Considering it does exactly what you need it to do, why not just use it – Eric B Jan 26 '17 at 21:39
  • Running dotnet publish is what I am using now, because that works. However, I'm not happy with it since I feel it's a step back in terms of change/verification turn-around compared to what we have achieved on our standard ASP.NET. – Sigurd Garshol Jan 27 '17 at 08:09

1 Answers1

0

Ok, I'm calling it on this one: This does not seem to be a viable option.

I'll give this a try instead:

In my services I accept a run url as described in this post:

dotnet run web site with specific url

powershell script starts up a list of services in new console windows using dotnet watch run:

$services = Get-Content .\services.json -Raw | ConvertFrom-Json;

foreach($serviCe in $services)
 { 
    $expression = "cmd /c start powershell -Command {"
    $expression += "Write-Host $($service.name) -ForegroundColor Yellow;"
    $expression += "Write-Host $($service.urls) -ForegroundColor Yellow;"
    $expression += "Set-Location $($service.path);"
    $expression += "Invoke-Expression `"dotnet watch run --server.urls=$($service.urls)`";"
    $expression += "sleep(10);"
    $expression += "}"
    Invoke-Expression $expression
    sleep(1);
}

And here is services.json with a list of services:

[
  {
    "name": "Products",
    "path": "C:\\Services\\src\\Products",
    "urls": "http://localhost:5000"
  },
  {
    "name": "Customers",
    "path": "C:\\Services\\src\\Customers",
    "urls": "http://localhost:5001"
  },
  {
    "name": "Statistics",
    "path": "C:\\Services\\src\\Statistics",
    "urls": "http://localhost:5002"
  }
]
Community
  • 1
  • 1
Sigurd Garshol
  • 1,376
  • 3
  • 15
  • 36