Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Adds hosting model as an extra deployment parameter #1261

Merged
merged 7 commits into from
Nov 10, 2017

Conversation

jkotalik
Copy link
Contributor

@jkotalik jkotalik commented Nov 9, 2017

For #1260

@dnfclas
Copy link

dnfclas commented Nov 9, 2017

@jkotalik,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

@@ -106,6 +106,8 @@ public class DeploymentParameters

public string PublishedApplicationRootPath { get; set; }

public HostingModel HostingModel { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set a default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@JunTaoLuo JunTaoLuo Nov 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, it would take the first value as the default (or whatever is the enum equivalent of 0). Do we want to default all tests to InProcess?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be out of process.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with changing the order of the enums but personally I prefer the more explicit approach where we just set the default value. Takes out all ambiguity.

@@ -148,6 +148,9 @@ private async Task<(Uri url, CancellationToken hostExitToken)> StartIISExpressAs
{
Logger.LogTrace($"Config File Content:{Environment.NewLine}===START CONFIG==={Environment.NewLine}{{configContent}}{Environment.NewLine}===END CONFIG===", serverConfig);
}
var hostingModel = DeploymentParameters.HostingModel.ToString();
serverConfig.Replace("[HostingModel]", hostingModel);
Logger.LogDebug("Writing HostingModel '{hostingModel} to ", hostingModel);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mismatched single quote and missing "config" after "to"

@@ -148,6 +148,9 @@ private async Task<(Uri url, CancellationToken hostExitToken)> StartIISExpressAs
{
Logger.LogTrace($"Config File Content:{Environment.NewLine}===START CONFIG==={Environment.NewLine}{{configContent}}{Environment.NewLine}===END CONFIG===", serverConfig);
}
var hostingModel = DeploymentParameters.HostingModel.ToString();
serverConfig.Replace("[HostingModel]", hostingModel);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just chain it here:

serverConfig =
serverConfig
.Replace("[ApplicationPhysicalPath]", contentRoot)
.Replace("[PORT]", port.ToString());

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contentRoot and port are inputs to StartIISExpressAsync. HostingModel isn't guaranteed to be set. I will add a check to see if HostingModel exists before setting it though.

@@ -1,2 +1,2 @@
version:2.1.0-preview1-15549
commithash:f570e08585fec510dd60cd4bfe8795388b757a95
version:2.1.0-preview1-15564
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natemcmaster are these changes expected every now and then?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, if you need a new version of build tools. The only reason to hold off for now is that the jump from 2.1.0-preview1-15549 to 2.1.0-preview1-15564 puts you ahead of aspnet/Universe

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -149,6 +149,13 @@ private async Task<(Uri url, CancellationToken hostExitToken)> StartIISExpressAs
Logger.LogTrace($"Config File Content:{Environment.NewLine}===START CONFIG==={Environment.NewLine}{{configContent}}{Environment.NewLine}===END CONFIG===", serverConfig);
}

if (serverConfig.Contains("[HostingModel]"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed as string.Replace will no-op if the old value is not found. Also we should not change the config after the changes were logged in https://github.com/aspnet/Hosting/pull/1261/files#diff-727b9f7850879229f0c886f7448a0b04R149. I still think it's best to include these updates at https://github.com/aspnet/Hosting/pull/1261/files#diff-727b9f7850879229f0c886f7448a0b04R138

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is for logging. It doesn't make sense to say we are replacing the hostingModel if the hosting model isn't replaced. I do agree with moving it above the config file content though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are debug logs so there's no harm in saying we tried replacing the hosting model but didn't end up finding anything to replace. Then again, I don't feel too strongly about it either way.

Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before checking this in, can you try adding a test that tests the in proc hosting model. In server tests maybe?

@jkotalik
Copy link
Contributor Author

The tests in IISIntegration are effectively the same as what are in ServerTests. However those tests are currently disabled until ANCM is in universe. If IIS integration relies on a new change to ANCM, there is no way to pick up that change. Eventually, ServerTests will have tests for InProcess, however it is too painful.

Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our travis builds seem to be unreliable lately. Random errors all the time. Not related to this change though.

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

Successfully merging this pull request may close these issues.

5 participants