Skip to content

Commit

Permalink
Allow running some IIS Express variants without publishing dotnet#1431
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher committed May 31, 2018
1 parent 23e3ab6 commit 8d55a44
Show file tree
Hide file tree
Showing 9 changed files with 1,228 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public DeploymentParameters(

public string ServerConfigLocation { get; set; }

public string SiteName { get; set; }
public string SiteName { get; set; } = "HttpTestSite";

public string ApplicationPath { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.IO;
using System.Runtime.InteropServices;

namespace Microsoft.AspNetCore.Server.IntegrationTesting.Common
namespace Microsoft.AspNetCore.Server.IntegrationTesting
{
internal static class DotNetCommands
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,22 @@ protected void CleanPublishedOutput()
}
}

protected string GetDotNetExeForArchitecture()
{
var executableName = DotnetCommandName;
// We expect x64 dotnet.exe to be on the path but we have to go searching for the x86 version.
if (DotNetCommands.IsRunningX86OnX64(DeploymentParameters.RuntimeArchitecture))
{
executableName = DotNetCommands.GetDotNetExecutable(DeploymentParameters.RuntimeArchitecture);
if (!File.Exists(executableName))
{
throw new Exception($"Unable to find '{executableName}'.'");
}
}

return executableName;
}

protected void ShutDownIfAnyHostProcess(Process hostProcess)
{
if (hostProcess != null && !hostProcess.HasExited)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,37 @@ public RemoteWindowsDeployer(RemoteWindowsDeploymentParameters deploymentParamet
$" Supported server types are {nameof(ServerType.Kestrel)}, {nameof(ServerType.IIS)} and {nameof(ServerType.HttpSys)}");
}

if (string.IsNullOrWhiteSpace(_deploymentParameters.ServerName))
if (string.IsNullOrEmpty(_deploymentParameters.ServerName))
{
throw new ArgumentException($"Invalid value '{_deploymentParameters.ServerName}' for {nameof(RemoteWindowsDeploymentParameters.ServerName)}");
}

if (string.IsNullOrWhiteSpace(_deploymentParameters.ServerAccountName))
if (string.IsNullOrEmpty(_deploymentParameters.ServerAccountName))
{
throw new ArgumentException($"Invalid value '{_deploymentParameters.ServerAccountName}' for {nameof(RemoteWindowsDeploymentParameters.ServerAccountName)}." +
" Account credentials are required to enable creating a powershell session to the remote server.");
}

if (string.IsNullOrWhiteSpace(_deploymentParameters.ServerAccountPassword))
if (string.IsNullOrEmpty(_deploymentParameters.ServerAccountPassword))
{
throw new ArgumentException($"Invalid value '{_deploymentParameters.ServerAccountPassword}' for {nameof(RemoteWindowsDeploymentParameters.ServerAccountPassword)}." +
" Account credentials are required to enable creating a powershell session to the remote server.");
}

if (_deploymentParameters.ApplicationType == ApplicationType.Portable
&& string.IsNullOrWhiteSpace(_deploymentParameters.DotnetRuntimePath))
&& string.IsNullOrEmpty(_deploymentParameters.DotnetRuntimePath))
{
throw new ArgumentException($"Invalid value '{_deploymentParameters.DotnetRuntimePath}' for {nameof(RemoteWindowsDeploymentParameters.DotnetRuntimePath)}. " +
"It must be non-empty for portable apps.");
}

if (string.IsNullOrWhiteSpace(_deploymentParameters.RemoteServerFileSharePath))
if (string.IsNullOrEmpty(_deploymentParameters.RemoteServerFileSharePath))
{
throw new ArgumentException($"Invalid value for {nameof(RemoteWindowsDeploymentParameters.RemoteServerFileSharePath)}." +
" . A file share is required to copy the application's published output.");
}

if (string.IsNullOrWhiteSpace(_deploymentParameters.ApplicationBaseUriHint))
if (string.IsNullOrEmpty(_deploymentParameters.ApplicationBaseUriHint))
{
throw new ArgumentException($"Invalid value for {nameof(RemoteWindowsDeploymentParameters.ApplicationBaseUriHint)}.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,22 +194,6 @@ public override async Task<DeploymentResult> DeployAsync()
}
}

private string GetDotNetExeForArchitecture()
{
var executableName = DotnetCommandName;
// We expect x64 dotnet.exe to be on the path but we have to go searching for the x86 version.
if (DotNetCommands.IsRunningX86OnX64(DeploymentParameters.RuntimeArchitecture))
{
executableName = DotNetCommands.GetDotNetExecutable(DeploymentParameters.RuntimeArchitecture);
if (!File.Exists(executableName))
{
throw new Exception($"Unable to find '{executableName}'.'");
}
}

return executableName;
}

public override void Dispose()
{
using (Logger.BeginScope("SelfHost.Dispose"))
Expand Down
Loading

0 comments on commit 8d55a44

Please sign in to comment.