Dys1
Dys1

Reputation: 90

VS 2013 C# and Wix Installing Windows Service that writes to event log

We are moving to Visual Studio 2013 and my current project i built in Vs2010 is a wcf service hosted by a windows service. I created a setup project and all worked as expected.

Moving to 2013, setup projects are no longer supported. I tried the InstallShield lt, its a sham trying to get us to spend more money. So i went to wix.

Testing the new deployment possibilities i built the basic windows service app here: http://msdn.microsoft.com/en-us/library/zt39148a(v=vs.110).aspx

When i used the Installshield LT it installed and created the application event log(There were other problems with that setup project that prevents me from using it)

So i created a wix setup project, which is pretty awesome except for the fact when you install it doesnt seem to grant correct permissions to write to event log.

If i comment out the code that writes to the event log on start, the service will start.

 Event1.WriteEntry("Command received to start service.");

If i dont i get the service failed to start. In wix i added this:

InstallPrivileges="elevated"  

But it made no difference. I searched stackOverflow and found another reffernce to this:

<Property Id="MSIUSEREALADMINDETECTION" Value="1" />

to force run as admin but all this did was force me to restart me machine whenever i uninstall, it still wont write to the event log.

I ran the msi from an eleveated command prompt as well with no luck.

The service will have its own logon name eventually but its currently set to LocalSystem.

I changed the account to my domain name(an administrator) and the service still will not start.

I changed the regkey permissions here HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog to full control for my account and nothing.

Its windows 7. Any and all help is much appreciated.

Upvotes: 0

Views: 694

Answers (1)

Dys1
Dys1

Reputation: 90

I did not include the app.config file in the setup and it never copied across. Including this file resolved my issue...

Upvotes: 1

Related Questions