Reputation: 5148
I have a C# service that works without any problems on my laptop (Windows 7). As soon has I install it on my Windows Server 2003 I get the following errors. First, right after clicking start in the service window, I get:
Could not start MyService service on Local Computer. Error 14001: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
In the event viewer I get the two following errors:
Source: SideBySide EventID: 58
Syntax error in manifest or policy file "C:\Program Files\HP\MyService\MyService.exe.Config" on line 9.
Source: SideBySide EventID: 59
Generate Activation Context failed for C:\Program Files\HP\MyService\MyService.exe. Reference error message: Manifest Parse Error : Internal error.
My .NET application has the target framework of .NET Framework 4 Client Profile. Both laptop and server have VCredist 05, 08 and 2010, and they both have .NET 4, 3.5 3, 2 and 1.1 installed.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!-- Make sure to add \ and end of path -->
<add key="xmlDistantFolder" value="\\127.0.0.1\epgdata\" />
<add key="xmlLocalFolder" value="c:\\folder\" />
<add key="runTargetExec" value="disabled" />
<add key="targetExe" value="c:\\Windows\explorer.exe" />
</appSettings>
</configuration>
Also, If I removed my app.config file (actually called MyService.exe.config) the service works, but it can't read the essential configuration data in it, thus making it useless.
I modified the target framework to .NET 3.5 and in the resources in Application tab in my project properties, and I've put in the manifest option to "Create application without a manifest" instead of "Embed manifest with default settings".
The service now starts, but I get an error about an invalid character in my configuration file. I've added this value, and it generates an error, saying that one of the character is invalid to XML. Any clues?
<add key="url" value="http://127.0.0.1/node/exec?path=c:\\\\Program Files\\\\myApp\\\\&exec=myExecutable.exe&flags=[%22/nouser%22,%22/console%22]" />
Upvotes: 1
Views: 7159
Reputation: 5148
Here is the solution to my problems:
To fix the Side-By-Side error, I set the manifest option to "Create application without a manifest" instead of "Embed manifest with default settings".
To fix the invalid character in my configuration file I modified the &
for &
. This makes the XML valid and parsable by the Configuration Manager class.
Upvotes: 4
Reputation: 181017
<add key="xmlLocalFolder" value="c:\\folder\" />
<add key="targetExe" value="c:\\Windows\explorer.exe" />
should probably be
<add key="xmlLocalFolder" value="c:\folder\" />
<add key="targetExe" value="c:\Windows\explorer.exe" />
although I can't see that generating the parse error you're seeing.
Upvotes: 1