The extension name ‘enableWebScript’ is not registered error

While deploying a project I am working on that contain an AJAX enabled WCF service, I got the following error:

Invalid element in configuration. The extension name ‘enableWebScript’ is not registered in the collection at system.serviceModel/extensions/behaviorExtensions.

After hours of searching, it turned out to be that when you run the wcf uninstall command as shown below, it removes with the configurations from the machine.config.

servicemodelreg.exe -u

I found someone who suggested to add the xml tags manually to the machine.config. Although it worked, I got other errors. At the end, I reinstalled .Net FrameWork 3.5 SP1, in order to resolve that issue.