简体   繁体   中英

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. 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

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

I would also try commenting out the x.UseNLog(); part in case that is getting in the way

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM