Some diagnostic messages cleanup on deployment helpers

This commit is contained in:
Praburaj 2015-04-15 10:01:44 -07:00
parent 7c5e95818f
commit 062722f1fb
3 changed files with 10 additions and 15 deletions

View File

@ -40,7 +40,7 @@ namespace DeploymentHelpers
#endif
)
{
logger.LogWarning("Failed to complete the request : {0}.", exception.Message);
logger.LogWarning("Failed to complete the request : {0}.", exception.InnerException.Message);
Thread.Sleep(7 * 1000); //Wait for a while before retry.
}
}

View File

@ -94,7 +94,13 @@ namespace DeploymentHelpers
startInfo.Environment["PATH"] = ChosenRuntimePath + ";" + startInfo.Environment["PATH"];
#endif
Process hostProcess = Process.Start(startInfo);
var hostProcess = Process.Start(startInfo);
if (hostProcess.HasExited)
{
Logger.LogError("Host process {processName} exited with code {exitCode} or failed to start.", startInfo.FileName, hostProcess.ExitCode);
throw new Exception("Failed to start host");
}
Logger.LogInformation("Started iisexpress. Process Id : {processId}", hostProcess.Id);
return hostProcess;

View File

@ -53,26 +53,15 @@ namespace DeploymentHelpers
};
AddEnvironmentVariablesToProcess(startInfo);
var hostProcess = Process.Start(startInfo);
//Sometimes reading MainModule returns null if called immediately after starting process.
Thread.Sleep(1 * 1000);
if (hostProcess.HasExited)
{
Logger.LogError("Host process {processName} exited with code {exitCode} or failed to start.", startInfo.FileName, hostProcess.ExitCode);
throw new Exception("Failed to start host");
}
try
{
Logger.LogInformation("Started {fileName}. Process Id : {processId}", hostProcess.MainModule.FileName, hostProcess.Id);
}
catch (Win32Exception)
{
// Ignore.
}
Logger.LogInformation("Started {fileName}. Process Id : {processId}", startInfo.FileName, hostProcess.Id);
return hostProcess;
}