The type provided as the Service attribute value in the ServiceHost directive could not be found

Some time when you use Add Service Reference to add reference to your WCF service, you may run into error like:

The type 'ForExService.Service1', provided as the Service attribute value in the ServiceHost directive could not be found

This error is very self explanatory telling that some type could not be found. Well if that type is missing in my service, how did the tool know about it. Well this exactly is the cause of this error. The tool looks at .svc file. And it found the following line in markup.


ServiceHost Language="C#" Debug="true" Service="ForExService.Service1" CodeBehind="CurrencyService.svc.cs

You probably can see the problem in line above. The service type is set to "ForExService.Service1" where the code behind was modified to name the service classes differently. So if you run into this kind of error, make sure that you check mark up of your service file as well to make sure that it matches the implementation in code.

comments powered by Disqus

Blog Tags