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” %>

8 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.


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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.