【发布时间】:2012-07-17 03:14:57
【问题描述】:
在我的解决方案中,我有一个控制台项目 reg 来启动我的应用程序,它工作正常
现在我想将控制台替换为 Windows 服务 Service1
但它不起作用并给我一个连接数据库的错误
这是我的解决方案,我使用Service1 item 而不是控制台reg
这是我的onStart 方法
protected override void OnStart(string[] args)
{
System.Diagnostics.Debugger.Launch();
EventLog.WriteEntry("Service Started...");
ConfigureServer();
}
这里出现问题无法运行登录请求的数据库xds
using (System.Management.Automation.PowerShell powershell = System.Management.Automation.PowerShell.Create())
{
powershell.Runspace = myRunSpace;
powershell.Commands.AddScript("Get-CsTrustedApplicationPool");
Collection<PSObject> results = null;
Collection<ErrorRecord> errors = null;
try
{
results = powershell.Invoke();
errors = powershell.Streams.Error.ReadAll();
}
【问题讨论】:
标签: c# powershell windows-services lync