The type <service>, provided as the Service attribute value in the ServiceHost directive could not be found.

February 26, 2008

I recently had a tough time to resolve this issue.

The problem: The WCF service stopped working without any “breaking” changes done

The exception: The type <xxxxx> provided as the Service attribute value in the ServiceHost directive could not be found. (Complete stack-trace below).

The solution: The class name (aka. type) was missing the complete signature. As my project assembly is strong named and GACed, the declaration should be “type, assembly, version, culturePublicKeyToken”).

 Earlier declaration: <% @ServiceHost Language=C# Debug=”true” Service=”typeXXXXX” %>

The corrected declaration: <% @ServiceHost Language=C# Debug=”true” Service=”typeXXXX, assembly,version=1.0.0.0, culturePublicKeyToken=xxxx” %>

About these ads

17 Responses to “The type <service>, provided as the Service attribute value in the ServiceHost directive could not be found.”

  1. mass Says:

    could u please write the below declaration with some example?

  2. mass Says:

    typeXXXX, assembly,version=1.0.0.0, culturePublicKeyToken=xxxx

  3. Stefano Ricciardi Says:

    Thank you, this helped me with when I tried to move all the assemblies to the GAC only for deployment.

  4. Ravi Says:

    Build the solution first, and then a add a service reference.

  5. SBlangkon Says:

    Try to check your spelling in svc. Because it must use case sensitive letter.

  6. G-Man Says:

    Thanks Ravi,
    The rebuild trick worked.

  7. John Oschwald Says:

    Thanks! The documentation I read said the assembly could be in the GAC but it would have been helpful if they had mentioned the @ServiceHost requirements in order to make that work! I appreciate you taking the time to share this.

  8. halone Says:

    I had same problem, I tried different ways,none of them worked, but my problem or solution was about have wrong namespace in the code, like:

    namespace MyCompany.MyProject
    {
    public class HHTInterface : IHHTInterface
    {
    }
    }

    by removing the namespace problem solved.

  9. Franklin Says:

    Thanks, This helped me resolve my problem.

  10. deepikamehta Says:

    Following is the error that i am getting in someone’s code which i have to modify.I dont have any experience regarding WCF but have initial knowledge

    Error:The type ‘Springwell.RestServices.DataService’, provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

    Below is the structur of my Webconfig file:

  11. tarun Says:

    change the build output path to “bin\” if not set and then run

  12. Rob Church Says:

    For anyone else wondering, this directive can be found in the .svc file itself, you need to edit it using “Open With…”

  13. robots Says:

    At last, after surfing http://dennyonline.wordpress.
    com/2008/02/26/the-type-service-provided-as-the-service-attribute-value-in-the-servicehost-directive-could-not-be-found/ for some time, I got a blog from which
    I was able to actually discover helpful details regarding the studies and the knowledge
    that I want. There need to be more things like this on Serendipity


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: