As I’ve finally gotten around to using Windows Communication Foundation (WCF) in recent projects, i got a test project setup fairly quickly which seemed to compile and run properly. I published the service to a test server and I encountered the following error
Service attribute value in the ServiceHost directive could not be found.
The type ‘ServiceName’, provided as the Service attribute value in the ServiceHost directive could not be found.
Now, as a neophyte working with WCF, I was perplexed by this problem. I knew that the service was compiling ok and when I went into debug mode of the project for the service the test method showed up and seemed to return what I expected.
I spent alot of time going through all of the service code to make sure there were no errors. Everything seemed fine there. I then went through all the info on the published test site and that seemed fine too. I was at a lost, but then tried Google. Alot of good resources came up, but none that helped me. Finally, it dawned on me that I left out an important step when setting up the test site on my test server. I hadn’t set the site to be an Application in IIS!!! Sigh, a quick jump into IIS and setting the site to an application solved this problem!
If this doesn’t solve your problem, try some of these solutions I found while researching this issue.
http://www.byteblocks.com/post/2009/03/10/Error-when-adding-service-reference-for-WCF-service.aspx
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/49d9279f-2bc1-482b-8bb0-da1261736acb/
http://www.thejoyofcode.com/WCF_The_type_provided_as_the_Service_attribute_could_not_be_found.aspx
[...] http://blog.divergencehosting.com/2010/02/11/wcf-published-services-returned-service-attribute-value... [...]