C# – Fails to start .NET app, ConfigurationErrorsException

.net-3.5cnetwinforms

I've installed a clean XP virtual machine for test purposes, only .NET 3.5 SP1 redistributable is applied.

When I try to start our WinForms app, it gives the following exception:

System.Configuration.ConfigurationErrorsException:
Configuration system failed to
initialize —>
System.Configuration.ConfigurationErrorsException:
Unrecognized configuration section
system.serviceModel.
(C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config
line 134)

The app works on other systems, I've never seen this before. What is extra interesting is that it's such clean machine with "only" XP and .NET 3.5 installed. We are not explicitly using WCF in the app either.

I've seen on some forum that they have removed a section from machine.config, but it feels wrong to have to do that on a clean install, there should be a better solution. Any ideas?

Best Answer

Looks like an installation issue. There is a bug raise on Connect.

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=323659

This is offical Microsoft recommendation:

In the meantime, you should be able repair your install by running:

"%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" /r /x

%windir%\Microsoft.NET\Framework\v3.5\WFServicesReg.exe /c