我正在尝试在Windows server2016上的docker容器中安装服务。
只需将服务放在那里并进行Powershelling:
New-Service -Name Bob -StartupType Automatic -BinaryPathName .\SVCHost.exe
添加服务但是在容器中我得到了结果:
PS C:\Program Files\COMPANY\Repository> start-service -Name bob
start-service : Service 'bob (Bob)' cannot be started due to the following error: Cannot start service Bob on computer '.'.
At line:1 char:1
+ start-service -Name bob
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
我尝试创建用户并设置启动用户凭据但问题相同。
查看https://github.com/Microsoft/sql-server-samples/blob/master/samples/manage/windows-containers/mssql-server-2016-express-windows/dockerfile表明他们使用sqlexpress来安装服务。
长话短说...... 如何在Windows Server 2016 Docker容器中注册服务
答案 0 :(得分:1)
另外,请查看Dockerfile for microsoft/iis。容器中的实际工作是在IIS Windows服务中完成的,但入口点是一个名为ServiceMonitor.exe
的二进制文件。监视器检查Windows服务,如果服务失败则exe失败,因此Docker知道容器不健康。
答案 1 :(得分:0)
完全限定安装名称有效。谢谢@Elton Stoneman
或者在我的程序中也发现了这个问题
StiReport myreport = new StiReport();
myreport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("DBConn", "Data Source =.; Initial Catalog = HoghooghDastmozd; Integrated Security = True"));
myreport.Load(Application.StartupPath + "\\Report.mrt");
myreport.Dictionary.Variables["IDP"].Value = textBox1.Text;
stiViewerControl1.Report = myreport;