Wcf – Problem with type of service in ServiceHost directive in wcf service

servicehostwcf

I am developing a simple wcf service for test. When I test this service with my local IIS 7.5, then it works properly. But when I host it in web IIS, I receive this error:

The type 'WcfServiceLibrary1.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.

And my ServiceHost is:

<%@ ServiceHost Language="C#" Debug="true" Service="WcfServiceLibrary1.Service1" %>

Please help me resolve this problem

Best Answer

Because I couldn't find this suggested in any of the questions I looked through for this, adding my case here:

I had this problem when I manually changed the namespace in the file MyService.svc.cs, and did not change the Service name in the corresponding file MyService.svc - turned out that it needed to be Service="namespace.classname".

Related Topic