WCF error


Error:   "The type ‘<name of the service class>’, provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found."

The above error was caused by my not providing the full path service name for the Service attribute of the ServiceHost.

Code Snippet:


The value for Service should follow the structure: namespace.class



WCF Publishing error

Server Error in ‘/generalservice’ Application.

The type ‘GeneralService.Service1’, provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/ serviceHostingEnvironment/serviceActivations could not be found.

“generalservice” is the name of the application in IIS. I renamed Service1 into “GeneralService” and the implementing class into Maths. But when I publish the service to IIS, I got the error above. The issue was in the GeneralService.svc (that was earlier named as “Service1.svc”) the ServiceHost  service was still registered as


Updated to Service=”GeneralService.Maths”. Issue Solved 🙂

Struggles at Learning WCF

I am using the book”Windows Communication Foundation Unleashed” by Craig McMurtry; Marc Mercuri; Nigel Watling; Matt Winkler to learn the intricacies of WCF.
I am really struggling with the configuration settings and get errors almost at every steps (even when blindly following the instructions in the book!). Listing some of the errors here for my reference.
I am trying to host my service on IIS 7
No protocol binding matches the given address ‘http://localhost:8000/XXXXX&#8217;. Protocol bindings are configured at the Site level in IIS or WAS configuration.
In the Web.config file, empty the endpoint address. While I had the following setting the above error was thrown:L
<endpoint contract="MyContractName"
                 binding=”basicHttpBinding”                 bindingConfiguration=”bindingSettings”
address=”http://localhost:8000/XXXXX” />

I made the change below for the service to be hosted successfully:
<endpoint contract="MyContractName"
                 binding=”basicHttpBinding”                 bindingConfiguration=”bindingSettings”

>WCF Exception "System.ServiceModel.ProtocolException was unhandled"

>I got the following irritating error while working with my basics of WCF:

System.ServiceModel.ProtocolException was unhandled

Message=”The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: ‘ \n \n \n \n \n<!– \nbody{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;background:#CBE1EF;} \ncode{margin:0;color:#006600;font-size:1.1em;font-weight:bold;} \n.config_source code{font-size:.8em;color:#000000;} \npre{margin:0;font-size:1.4em;word-wrap:break-word;} \nul,ol{margin:10px 0 10px 40px;} \nul.first,ol.first{margin-top:5px;} \nfieldset{padding:0 15px 10px 15px;} \n.summary-container fieldset{padding-bottom:5px;margin-top:4px;} \nlegend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;} \nlegend{color:#333333;padding:4px 15px 4px 10px;margin:4px 0 8px -12px;_margin-top:0px; \n border-top:1px solid #EDEDED;border-left:1px solid #EDEDED;border-right:1px solid #969696; \n border-bottom:1px solid #969696;background:#E7ECF0;font-weight:bold;'."



The resolution:

In a Windows 7 PC:


Control Panel -> Programs and Features -> Turn Windows Feature on or Off -> .Net Framework 3.5.1 ->  Enable Windows Communication Foundation HTTP Activation