本文整理汇总了C#中DeploymentResult.AddNote方法的典型用法代码示例。如果您正苦于以下问题:C# DeploymentResult.AddNote方法的具体用法?C# DeploymentResult.AddNote怎么用?C# DeploymentResult.AddNote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeploymentResult
的用法示例。
在下文中一共展示了DeploymentResult.AddNote方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyRegistryHivePermissions
protected void VerifyRegistryHivePermissions(DeploymentResult result)
{
if (Hive == RegistryHive.CurrentUser)
{
result.AddNote("Elevated permissions not required for Registry Hive '{0}'", Hive.AsRegistryHiveString());
return;
}
}
示例2: VerifyCanRun
public override DeploymentResult VerifyCanRun() {
var result = new DeploymentResult();
result.AddNote(_reason);
if(_filesShouldExist.Count > 0) {
var tmpDR = new DeploymentResult();
foreach(var filePath in _filesShouldExist) {
string actualPath = _path.GetFullPath(filePath);
if(!File.Exists(actualPath)) { tmpDR.AddError(" File '{0}' should exist!.".FormatWith(actualPath)); }
}
result.MergedWith(tmpDR);
//errors show up anyway, give some feedback if everything OK.
if(!tmpDR.ContainsError()) { result.AddNote(" All {0} files found!".FormatWith(_filesShouldExist.Count)); }
} else {
result.AddNote(" No Files that should exist.");
}
if(_directoriesShouldExist.Count > 0) {
var tmpDR = new DeploymentResult();
foreach(var dirPath in _directoriesShouldExist) {
string actualPath = _path.GetFullPath(dirPath);
if(!Directory.Exists(actualPath)) { tmpDR.AddError(" Directory '{0}' should exist".FormatWith(actualPath)); }
}
result.MergedWith(tmpDR);
//errors show up anyway, give some feedback if everything OK.
if(!tmpDR.ContainsError()) { result.AddNote(" All {0} directories found!".FormatWith(_directoriesShouldExist.Count)); }
} else {
result.AddNote(" No Directories that should exist.");
}
if(_filesShould_NOT_Exist.Count > 0) {
var tmpDR = new DeploymentResult();
foreach(var filePath in _filesShould_NOT_Exist) {
string actualPath = _path.GetFullPath(filePath);
if(File.Exists(actualPath)) { tmpDR.AddError(" File '{0}' should NOT exist!.".FormatWith(actualPath)); }
}
result.MergedWith(tmpDR);
if(!tmpDR.ContainsError()) { result.AddNote(" None of the {0} files exist!".FormatWith(_filesShould_NOT_Exist.Count)); }
} else {
result.AddNote(" No Files that should NOT exist.");
}
if(_directoriesShould_NOT_Exist.Count > 0) {
var tmpDR = new DeploymentResult();
foreach(var dirPath in _directoriesShould_NOT_Exist) {
string actualPath = _path.GetFullPath(dirPath);
if(Directory.Exists(actualPath)) { tmpDR.AddError(" Directory '{0}' should NOT exist".FormatWith(actualPath)); }
}
result.MergedWith(tmpDR);
if(!tmpDR.ContainsError()) { result.AddNote(" None of the {0} directories exist!".FormatWith(_directoriesShould_NOT_Exist.Count)); }
} else {
result.AddNote(" No Directories that should NOT exist.");
}
if(_shouldAbortOnError && result.ContainsError()) { result.AddAbort(_reason); }
return result;
}
示例3: Ex
void Ex(Action<DeploymentDetail> action)
{
var result = new DeploymentResult();
result.AddNote(Name);
foreach (var role in _roles)
{
result.AddNote(role.Name);
role.ForEachServerMapped(s =>
{
result.AddNote(s.Name);
s.ForEachDetail(d =>
{
result.AddNote(d.Name);
action(d);
});
});
}
}
示例4: VerifyCanRun
public DeploymentResult VerifyCanRun()
{
var results = new DeploymentResult();
results.AddNote(Name);
//check you can connect to the _instancename
//check that the path _scriptsLocation exists
return results;
}
示例5: BuildVirtualDirectory
void BuildVirtualDirectory(Site site, ServerManager mgr, DeploymentResult result)
{
Magnum.Guard.AgainstNull(site, "The site argument is null and should not be");
var appPath = "/" + VirtualDirectoryPath;
//this didn't find the application if there is a difference in letter casing like '/MyApplication' and '/Myapplication'. But threw an exception when tried to add it.
//var application = site.Applications.FirstOrDefault(x => x.Path == appPath);
var application = site.Applications.FirstOrDefault(x => x.Path.Equals(appPath, StringComparison.OrdinalIgnoreCase));
if (application == null)
{
result.AddAlert("'{0}' doesn't exist. creating.", VirtualDirectoryPath);
application = site.Applications.Add(appPath, PathOnServer);
LogFineGrain("[iis7] Created application '{0}'", VirtualDirectoryPath);
}
else
{
result.AddNote("'{0}' already exists. Updating settings.", VirtualDirectoryPath);
}
if (application.ApplicationPoolName != AppPoolName)
{
application.ApplicationPoolName = AppPoolName;
LogFineGrain("[iis7] Set the ApplicationPool for '{0}' to '{1}'", VirtualDirectoryPath, AppPoolName);
}
var vdir = application.VirtualDirectories["/"];
if (vdir.PhysicalPath != PathOnServer)
{
vdir.PhysicalPath = PathOnServer;
LogFineGrain("[iis7] Updated physical path for '{0}' to '{1}'", VirtualDirectoryPath, PathOnServer);
}
ConfigureAuthentication(mgr, result, true);
//result.AddGood("'{0}' was created/updated successfully", VirtualDirectoryPath);
}
示例6: VerifyCanRun
public DeploymentResult VerifyCanRun()
{
var results = new DeploymentResult();
results.AddNote(Name);
if(_connectionInfo.WillPromptForUserName())
results.AddAlert("We are going to prompt for a username.");
if (_connectionInfo.WillPromptForPassword())
results.AddAlert("We are going to prompt for a password.");
//check you can connect to the _instancename
//check that the path _scriptsLocation exists
return results;
}
示例7: Execute
public override DeploymentResult Execute()
{
var result = new DeploymentResult();
using (var iisManager = ServerManager.OpenRemote(ServerName))
{
var site = iisManager.Sites[SiteName];
if (site == null)
result.AddNote(siteDoesNotExist);
else
{
checkForElevatedPrivileges(() => Operation.Action(site));
iisManager.CommitChanges();
result.Add(new DeploymentItem(Operation.ReportingLevel, "Site operation '{0}' executed on '{1}'".FormatWith(Operation.Name, SiteName)));
}
}
return result;
}
示例8: checkSiteExists
private void checkSiteExists(ServerManager iisManager, DeploymentResult result)
{
if (!iisManager.Sites.Any(a => a.Name == SiteName)) result.AddNote(siteDoesNotExist);
}
示例9: Tracer
public static DeploymentResult Tracer(Task task)
{
var r = new DeploymentResult();
r.AddNote(task.Name);
return r;
}
示例10: ExecuteOperation
//todo: there is quite a bit going on in here...this is going to need to be looked at...
private void ExecuteOperation(ApplicationPool appPool, DeploymentResult result)
{
switch (Operation)
{
case Iis7ApplicationPoolOperation.StopApplicationPool:
if (appPool == null)
{
result.AddAlert(ApplicationPoolDoesNotExistError);
}
else if (appPool.CanBeStopped())
{
CheckForElevatedPrivileges(appPool.StopAndWaitForCompletion);
result.AddGood("Application Pool '{0}' stopped.".FormatWith(ApplicationPool));
}
else
{
result.AddNote("Application Pool '{0}' is not running.".FormatWith(ApplicationPool));
}
break;
case Iis7ApplicationPoolOperation.StartApplicationPool:
if (appPool == null)
{
throw new InvalidOperationException(ApplicationPoolDoesNotExistError);
}
else if (appPool.CanBeStarted())
{
IisUtility.WaitForIisToCompleteAnyOperations();
CheckForElevatedPrivileges(appPool.StartAndWaitForCompletion);
result.AddGood("Application Pool '{0}' started.".FormatWith(ApplicationPool));
}
else
{
result.AddGood("Application Pool '{0}' is already running.".FormatWith(ApplicationPool));
}
break;
}
}
示例11: updateSiteBindings
void updateSiteBindings(Site site, DeploymentResult result)
{
if (Bindings == null)
{
result.AddNote("No site bindings specified.");
return;
}
LogFineGrain("Checking certificates on existing HTTPS bindings");
updateHttpsBindingCertificates(site, result);
LogFineGrain("Adding new IIS bindings");
addnewBindings(site, result);
LogFineGrain("Removing IIS bindings that are no longer required");
removeOldBindings(site, result);
result.AddGood("Updated bindings for website '{0}'", WebsiteName);
}
示例12: buildVirtualDirectory
void buildVirtualDirectory(Site site, DeploymentResult result)
{
Magnum.Guard.AgainstNull(site, "The site argument is null and should not be");
var appPath = "/" + VirtualDirectoryPath;
var application = site.Applications.FirstOrDefault(x => x.Path == appPath);
if (application == null)
{
result.AddAlert("'{0}' doesn't exist. creating.", VirtualDirectoryPath);
application = site.Applications.Add(appPath, PathOnServer);
LogFineGrain("[iis7] Created application '{0}'", VirtualDirectoryPath);
}
else
{
result.AddNote("Virtual Directory '{0}' already exists. Updating settings.", VirtualDirectoryPath ?? "/");
}
var apn = AppPoolName ?? DefaultAppPoolName;
if (application.ApplicationPoolName != apn)
{
application.ApplicationPoolName = apn;
LogFineGrain("[iis7] Set the ApplicationPool for '{0}' to '{1}'", VirtualDirectoryPath, apn);
}
var vdir = application.VirtualDirectories["/"];
var pon = PathOnServer ?? DefaultPathOnServer;
if (vdir.PhysicalPath != pon)
{
vdir.PhysicalPath = pon;
LogFineGrain("[iis7] Updated physical path for '{0}' to '{1}'", VirtualDirectoryPath, pon);
}
}
示例13: checkForSiteBindingConflict
static void checkForSiteBindingConflict(ServerManager iisManager, string targetSiteName, IEnumerable<IisSiteBinding> targetBindings, DeploymentResult result)
{
if (targetBindings == null || !targetBindings.Any())
{
result.AddNote("[iis7] No bindings specified for site '{0}'".FormatWith(targetSiteName));
return;
}
foreach (var targetPort in targetBindings.Select(x => x.Port))
{
var conflictSite = iisManager.Sites
.FirstOrDefault(x => x.Bindings.Any(b =>
b.EndPoint != null &&
targetPort == b.EndPoint.Port) &&
x.Name != targetSiteName);
if (conflictSite != null)
throw new InvalidOperationException(
String.Format("Cannot create site '{0}': port '{1}' is already in use by '{2}'.",
targetSiteName, targetPort, conflictSite.Name));
}
result.AddGood("[iis7] No site binding conflicts detected.");
}
示例14: BuildVirtualDirectory
void BuildVirtualDirectory(Site site, ServerManager mgr, DeploymentResult result)
{
Magnum.Guard.AgainstNull(site, "The site argument is null and should not be");
var appPath = "/" + VirtualDirectoryPath;
var application = site.Applications.FirstOrDefault(x => x.Path == appPath);
if (application == null)
{
result.AddAlert("'{0}' doesn't exist. creating.", VirtualDirectoryPath);
application = site.Applications.Add(appPath, PathOnServer);
LogFineGrain("[iis7] Created application '{0}'", VirtualDirectoryPath);
}
else
{
result.AddNote("'{0}' already exists. Updating settings.", VirtualDirectoryPath);
}
if (application.ApplicationPoolName != AppPoolName)
{
application.ApplicationPoolName = AppPoolName;
LogFineGrain("[iis7] Set the ApplicationPool for '{0}' to '{1}'", VirtualDirectoryPath, AppPoolName);
}
var vdir = application.VirtualDirectories["/"];
if (vdir.PhysicalPath != PathOnServer)
{
vdir.PhysicalPath = PathOnServer;
LogFineGrain("[iis7] Updated physical path for '{0}' to '{1}'", VirtualDirectoryPath, PathOnServer);
}
ConfigureAuthentication(mgr, result, true);
//result.AddGood("'{0}' was created/updated successfully", VirtualDirectoryPath);
}
示例15: Execute
public DeploymentResult Execute()
{
var result = new DeploymentResult();
var psi = new ProcessStartInfo(Command, Args);
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
psi.RedirectStandardOutput = true;
if (!string.IsNullOrEmpty(WorkingDirectory)) psi.WorkingDirectory = WorkingDirectory;
psi.FileName = _path.Combine(ExecutableIsLocatedAt, Command);
string output;
try
{
using (Process p = Process.Start(psi))
{
//what to do here?
p.WaitForExit(30.Seconds().Milliseconds);
output = p.StandardOutput.ReadToEnd();
result.AddNote(output);
}
result.AddGood("Command Line Executed");
}
catch (Win32Exception ex)
{
result.AddError(
"An exception occured while attempting to execute the following remote command. Working Directory:'{0}' Command:'{1}' Args:'{2}'{3}{4}"
.FormatWith(WorkingDirectory, Command, Args, Environment.NewLine, ex));
}
return result;
}