I have a windows service written in C# and installed on my machine by using the installUtil.exe utility. After the installation completes successfully, I am trying to start the service. However it is giving me a 1053 error.
Now the truly weird thing is that when I delete the Config file the service starts just fine (Although then it stops because of a null pointer Exception, which is to be expected since there is no config file).
Any insights on this? I'm at loss here I've installed another service on the same machine which works just fine.
Note: the OS is Windows 7 Home Premium x64
edit =======
To make it clear, I tried logging (using the event Viewer) in the OnStart()
Method. When the log file is deleted I can see all the log entries and the service works fine up to the point where it needs to get data from the config file.
The problem seems to be when the config file is still present. The first line of the OnStart()
Method makes a log entry, HOWEVER, the program is not reaching this point.
edit 2 ========================
protected override void OnStart(string[] args)
{
try
{
this.EventLog.WriteEntry("Starting Focus Stock Service");
This log entry is being logged only if the config file is not present otherwise it will not get to this point.
> <?xml version="1.0"?> <configuration> <appSettings>
> <add key="Directory" value="C:\Logs\FocusCommon"/>
> <add key="FileName" value="log"/>
> <add key="LogLevel" value="3"/>
> <add key="StockRemotingServerPort" value="10001"/>
> <add key="StockRemotingServerName" value="FocusStockServer"/>
> <add key="SQLServerConnStringTemplate" value="server=$server$;uid=$username$;pwd=$password$;database=$database$;MultipleActiveResultSets=True;Pooling=False;"/>
> <add key="AccountingSynchIntervalMinutes" value="1"/>
> <add key="LocalImageDirectory" value="C:\Focus360_Image_Dir"/>
> <add key="LocalBrandImageDirectory" value="C:\Focus360_Image_Dir\Brands"/>
> <add key="LocalAttachmentDirectory" value="C:\Focus360_Attachment_Dir"/>
> <add key="EmailServer" value="maltanet.net" />
> <add key="EmailPort" value="25" />
> <add key="EmailUserName" value="" />
> <add key="EmailPassword" value="" />
> <add key="EmailUseSSL" value="false" /> </appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSS_SQLConnPool" publicKeyToken="40FEE7F833FAA042" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.0.4525.28539" newVersion="1.0.4525.28539"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>