0

I have an problem with update Windows Services that running in server. I change only DLL but when i want to start it server just crash with error 1053. Event Viewer in windows show some more error :

Exception Info: System.TypeInitializationException.

I was almost sure that i just do something wrong in my code but to be sure i run this service local ( on my own laptop ) and there is no any issue service start proper. On server i have same DLL as local ( copy paste ). Have You any idea how to resolve this issue ? I need end this server fast.

private static void Main()
{
    try
    {
        var dlls = new string[] { "Service.DataAccess", "SomeDll.Info", "SomeDll.Detail", "SomeDll.Some" };
        new AssemblyLoader(dlls).Load();
        XmlConfigurator.Configure();

        AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        ServiceBase[] ServicesToRun;

        ServicesToRun = new ServiceBase[] {new Service_SRV()};

        ServiceBase.Run(ServicesToRun);
    }
    catch(Exception e)
    {
        RecordError(e);
        throw;

    }
}

I just change DLL name but there are proper no type errors. At end i want to add that i read this topic : Error 1053: the service did not respond to the start or control request in a timely fashion

Nothing helped, it's still working on the local computer, but not on the server. What sort of problem might make that local it work and on server not ?

Community
  • 1
  • 1
Aht
  • 583
  • 4
  • 25

2 Answers2

1

Check whether you have mentioned any file paths in app.config file or any hardcoded file paths in your code.

If that is the case, you may need to update the path the server machine.

Vidya
  • 196
  • 14
1

Did you add your new DLL to the GAC? Otherwise your dll neeed to be in the same directory as your console application. Maybe in a subfolder named bin.

Also, did you compile for the same version of the framework? Does the used framework exist on the server?

lobiZoli
  • 199
  • 9
  • Yes it still same framework and DLL are in same folder – Aht Jan 22 '16 at 12:39
  • @Aht The error message indicates that your service IS loaded but takes too long time to start. If you changed the name, is there any dependencies that still references the old name? Configurations? Configuration sections/keys? Registry keys? – lobiZoli Jan 22 '16 at 13:48
  • Yes message say this but server crash after 3 - 5 s and send timeout error ( 30 s ). Config files are fine same config work on local without problem – Aht Jan 22 '16 at 14:07
  • @Aht Does your dll have any references to assemblies that you have not deployed new version of? You maybe could use debugview from sysinternals to see if any debug/trace messages from your assemblies are printed... – lobiZoli Jan 22 '16 at 14:13