[英]Error 1053. The service did not respond to the request in a timely manner
I get an error when installing the service.安装服务时出现错误。 I launch the console on behalf of the admin, enter the command: ServiceKisTopshelf.exe install.
我代表管理员启动控制台,输入命令:ServiceKisTopshelf.exe install。 What could be the problem?
可能是什么问题呢?
Can't install the service.无法安装服务。 I use the topshelf.
我用顶架。
class Program
{
static void Main(string[] args)
{
var host = HostFactory.New(x => //1
{
x.StartAutomaticallyDelayed();
x.Service<StartProgram>(s => //2
{
s.ConstructUsing(name => new StartProgram()); //3
s.WhenStarted(sp => sp.Start()); //4
s.WhenStopped(sp => sp.Stop()); //5
});
x.RunAsLocalSystem(); //6???
x.SetServiceName("ServiceKisTopshelf"); //7
x.SetDisplayName("ServiceKisTopshelf"); //8
x.SetDescription("ServiceKIS Topshelf Host"); //9
x.UseNLog();
});
host.Run();
}
}
App.config应用程序配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="DbProjectsContext" connectionString="data source=innc-mssqle01;initial catalog=db_projects;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Library" />
</assemblyBinding>
</runtime>
</configuration>
whether you are using Topshelf or SC.exe etc should not really matter (usually), can see a few similar ones eg Error 1053: the service did not respond to the start or control request in a timely fashion etc无论您使用的是 Topshelf 还是 SC.exe 等(通常)都无关紧要,可以看到一些类似的,例如错误 1053:服务没有及时响应启动或控制请求等
As mentioned in a couple of related SO posts, do check your environment whether admin mode, maybe check on a second machine, a VM or sandbox正如在一些相关的 SO 帖子中提到的,请检查您的环境是否为管理员模式,也许检查第二台机器、VM 或沙箱
I would also try commenting out the x.UseNLog();我也会尝试注释掉 x.UseNLog(); part in case that is getting in the way
部分以防万一
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.