错误1053,服务没有及时响应请求
Posted
技术标签:
【中文标题】错误1053,服务没有及时响应请求【英文标题】:Error 1053. The service did not respond to the request in a timely manner 【发布时间】:2021-03-13 01:59:49 【问题描述】:安装服务时出现错误。 我代表管理员启动控制台,输入命令:ServiceKisTopshelf.exe install。 可能是什么问题?
无法安装服务。我用顶架。
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>
【问题讨论】:
【参考方案1】:您使用的是 Topshelf 还是 SC.exe 等并不重要(通常),可以看到一些类似的,例如Error 1053: the service did not respond to the start or control request in a timely fashion等
正如在一些相关的 SO 帖子中提到的,请检查您的环境是否为管理员模式,也许检查第二台机器、VM 或沙箱
我也会尝试注释掉 x.UseNLog();部分以防万一
【讨论】:
以上是关于错误1053,服务没有及时响应请求的主要内容,如果未能解决你的问题,请参考以下文章