本文整理汇总了C#中Business.EnsureExecutableIsAvailabeOnServer方法的典型用法代码示例。如果您正苦于以下问题:C# Business.EnsureExecutableIsAvailabeOnServer方法的具体用法?C# Business.EnsureExecutableIsAvailabeOnServer怎么用?C# Business.EnsureExecutableIsAvailabeOnServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Business
的用法示例。
在下文中一共展示了Business.EnsureExecutableIsAvailabeOnServer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateInstanceOnServer
//private string _serviceUserName;
//private string _servicePassword;
internal void UpdateInstanceOnServer(Business.Server server, SetStatusLabelDelegate setStatusLabelDelegate)
{
//ImpersonateUser impersonateUser = null;
try
{
//if (server.UseImpersonation == true)
//{
// setStatusLabelDelegate("Impersonating user: " + server.UserName);
// impersonateUser = new ImpersonateUser(server.UserName, Encryption.Decrypt(server.Password));
//}
setStatusLabelDelegate("Checking MemCacheD.exe on remote server.");
string binaryPath = server.EnsureExecutableIsAvailabeOnServer(false);
string userName = null;
string password = null;
if (server.UseImpersonation == true)
{
userName = server.UserName;
password = Encryption.Decrypt(server.Password);
}
setStatusLabelDelegate("Updating service on remote server.");
WmiService.CreateOrUpdate(server.ServerName, userName, password, this.ServiceName, this.DisplayName, this.CreateImagePath(), StartMode.Auto, null, null);
}
finally
{
//if (impersonateUser != null && impersonateUser.IsImpersonating == true)
// impersonateUser.Undo();
}
/*
string description = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + _serviceController.ServiceName).GetValue("Description").ToString();
string imagePath = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + _serviceController.ServiceName).GetValue("ImagePath").ToString();
string newImagePath = imagePath.Substring(0, imagePath.LastIndexOf("memcached.exe") + ((string)("memcached.exe")).Length);
int tcpPort;
if (int.TryParse(txtTcpPort.Text, out tcpPort) == true)
newImagePath += " -p " + tcpPort;
int udpPort;
if (int.TryParse(txtUdpPort.Text, out udpPort) == true)
newImagePath += " -U " + udpPort;
if (chkMaximizeCoreFile.Checked == true)
newImagePath += " -r";
int maxMemory;
if (int.TryParse(txtMemoryLimit.Text, out maxMemory) == true)
newImagePath += " -m " + maxMemory;
Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + _serviceController.ServiceName, true).SetValue("ImagePath", newImagePath);
Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + _serviceController.ServiceName, true).SetValue("DisplayName", txtInstanceName.Text);
bool requiresRestart = false;
if (_serviceController.Status == ServiceControllerStatus.Running)
{
requiresRestart = true;
lblStatus.Text = "Stopping " + txtInstanceName.Text;
Refresh();
_serviceController.Stop();
}
lblStatus.Text = "Removing " + _serviceController.DisplayName;
Refresh();
ServiceUtility.UninstallService(_serviceController.ServiceName);
lblStatus.Text = "Reinstalling " + txtInstanceName.Text;
Refresh();
ServiceUtility.InstallService(_serviceController.ServiceName, txtInstanceName.Text, description, newImagePath);
if (requiresRestart == true)
{
lblStatus.Text = "Starting " + txtInstanceName.Text;
Refresh();
_serviceController.Start();
}
lblStatus.Text = "Ready.";
*/
}