views:

566

answers:

0

The problem (after much head scratching) is fixed now, so I'm just trying to understand what went wrong with my WCF settings. I just had a problem where I ran ServiceModelReg.exe to fix some .svc handler mappings in IIS7 and started getting HTTP 500 errors and event log entries like this:

WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/33711845
Exception: System.ServiceModel.ServiceActivationException: The service '/newweb/Service.svc' cannot be activated due to an exception during compilation.  The exception message is: Invalid element in configuration. The extension name 'enableWebScript' is not registered in the collection at system.serviceModel/extensions/behaviorExtensions.  (C:\dev\AgentDesktop\ui\newweb\web.config line 174). ---> System.Configuration.ConfigurationErrorsException: Invalid element in configuration. The extension name 'enableWebScript' is not registered in the collection at system.serviceModel/extensions/behaviorExtensions.  (C:\dev\AgentDesktop\ui\newweb\web.config line 174)

I did a lot of googling to try to find the answer, and there were many that looked plausible, but in the end I had to do a diff on the machine.config between a healthy and unhealthy machine. I was surprised to see that the system.serviceModel section of my machine.config file had been erased, despite the fact that I had run ServiceModelReg.exe -i.

Can anyone explain how or why this was erased? I'm just curious. The reason I thought it was worth posting here is that I think there is more going on here than meets the eye. I have VS 2010 beta 2 installed with .NET 4 beta. I am wondering whether any machine.config changes that should have taken place in the .NET 2 machine.config actually got applied to the .NET 4 file? Am I right?