I wrote a Windows Service to run on Win10, and it worked perfectly fine until I decided to change it a bit. I rewrote some logic, tested it in both Debug and Release configurations, and everything was fine. Then I uninstalled the current version of the service using `installutil.exe /u %servicename.exe%` and reinstalled it again using `installutil.exe %servicename.exe%`.
For some reason, this new version cannot start, and it crashes with Error 1064. This is the full error text:

`Windows could not start %servicename% service on Local Computer. Error 1064: An exception occurred in the service when handling the control request.`

The last time I installed this service, I ran into some difficulties, but quickly fixed them by changing the `Log On` properties. This time, it is not working. Please help with this issue.

Thanks.

**Update 1**

Here are my `Main()` and `OnStart()` service methods:

`Main()`

```
static void Main()
{
#if DEBUG
    var service = new SalesforceToJiraService();
    service.OnDebug();
    Thread.Sleep(Timeout.Infinite);
#else
    ServiceBase[] ServicesToRun;
    ServicesToRun = new ServiceBase[]
    {
        new SalesforceToJiraService()
    };
     ServiceBase.Run(ServicesToRun);
#endif
}

```

`OnStart()`

```
protected override void OnStart(string[] args)
{
    this.ConfigureServices();

    this.timer.Start();
    this.logger.Information("SalesforceToJira service started.");
}

```

**Update 2**

More code:

`ConfigureServices()`

```
protected void ConfigureServices()
{
    this.configuration = ConfigurationHelper.LoadConfiguration(ConfigurationPath);
    this.logger = ConfigurationHelper.ConfigureLogger(this.configuration.Logs.LogsPath);

    this.timer = ConfigurationHelper.ConfigureTimer(this.configuration.ProcessInterval.TotalMilliseconds,
        (sender, eventArgs) => this.ProcessCasesAsync(sender, eventArgs).GetAwaiter().GetResult());

    this.salesforceClient = new SalesforceCliClient(this.configuration.Salesforce.CliPath);

    this.jiraClient = Jira.CreateRestClient(
        this.configuration.Jira.Url,
        this.configuration.Jira.Username,
        this.configuration.Jira.Password);
}

```

I'm using `Newtonsoft.JSON` for deserializing a JSON configuration file, `Serilog` for logging, `System.Timers.Timer` for periodic events, `AtlassianSDK` for the Jira API and some wrappers over `Salesforce CLI` for Salesforce.