Search code examples
.netwindowswcfsecuritywindows-services

Exception when Windows Service(WCF) is starting on SOME computers?


I have a WCF service using net.tcp communication to a fat winforms client. The installation of the windows service is made with a install.bat that looks like this :

@ECHO OFF

REM The following directory is for .NET 4.0
set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319
set PATH=%PATH%;%DOTNETFX2%

echo Installing IEPPAMS Win Service...
echo ---------------------------------------------------
C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil "%~dp0MyApp.WindowsService.exe"
echo ---------------------------------------------------
pause
echo Done.

On some computers I need to save this bat as ASKI and also get full rights on the .NET Framework 4.0 folder but other then that the service is usually installed and started without problems.

But then on some computers I will get the following message when trying to start the service :

The MyApp service on MyComputer started and then stopped. Some services stop automatically if they are not in use by other service or program.

Windows Event log states this exception :

Service cannot be started. System.ServiceModel.FaultException`1[MyApp.DataContracts.FaultContracts.Generellt.GeneralFault]: (Fault Detail is equal to MyApp.DataContracts.FaultContracts.Generellt.GeneralFault).

When starting the service 3 WCF service will start and all of them have there own baseadress and port number.

I suspect that this have something to do with a extra secured environment? But I don't know how to solve it.

This have been tested on Windows 2003 and 2008 R2


Solution

  • The problem here was that there was error in data from database and the exception handling did not work at startup.