title: Why do I get "Type could not be found" WCF error on IIS server but not locally with Visual Studio 2010?
body: <p>The error is:</p>
  
  <blockquote>
    <p>The type 'WF.XXX.WebServices.XXXXService', provided as the Service
    attribute value in the ServiceHost directive, or provided in the
    configuration element
    system.serviceModel/serviceHostingEnvironment/serviceActivations could
    not be found.</p>
  </blockquote>
  
  <p>Stack Trace: </p>
  
  <blockquote>
    <p>[InvalidOperationException: The type 'WF.XXX.WebServices.XXXXService',
    provided as the Service attribute value in the ServiceHost directive,
    or provided in the configuration element
    system.serviceModel/serviceHostingEnvironment/serviceActivations could
    not be found.]<br>
    System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String
    constructorString, Uri[] baseAddresses) +52742<br>
    System.ServiceModel.HostingManager.CreateService(String
    normalizedVirtualPath) +1459<br>
    System.ServiceModel.HostingManager.ActivateService(String
    normalizedVirtualPath) +44<br>
    System.ServiceModel.HostingManager.EnsureServiceAvailable(String
    normalizedVirtualPath) +623</p>
    
    <p>[ServiceActivationException: The service
    '/XXXXX/XXXXXService/XXXXService.svc' cannot be activated due to an
    exception during compilation.  The exception message is: The type
    'WF.XXX.WebServices.XXXXService', provided as the Service attribute
    value in the ServiceHost directive, or provided in the configuration
    element
    system.serviceModel/serviceHostingEnvironment/serviceActivations could
    not be found..]    System.Runtime.AsyncResult.End(IAsyncResult result)
    +687598    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult
    result) +190<br>
    System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult
    ar) +304662<br>
    System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult
    ar) +94</p>
  </blockquote>
  
  <p>How to fix this error on the server?</p>
  
  <p><strong><em>Update on 9/18/2012:</em></strong>
  I have Visual Studio 2012 and .NET Framework 4.5 installed on my machine but server has only .NET Framework 4.0.  I am not sure if this matters, because I built the service with .NET Framework 4.0.</p>
  
  <p>But strangely, I noticed a 4.5 feature when I run my project.  It shows a URL to singleWSDL file, which is not available in .NET 4.0 version.  Why does this show up when the project is built with .NET Framework 4.0?  Here is the screenshot:
  <img src="https://i.stack.imgur.com/vCWhi.png" alt="enter image description here"></p>
  
  <p><strong><em>Update 9/19/12:</em></strong></p>
  
  <p>Here is the relavant web.config file:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service name="XXXXService"&gt;
          &lt;!-- Use a bindingNamespace to eliminate tempuri.org --&gt;
          &lt;endpoint address=""  name="XXXXService"
                    binding ="basicHttpBinding" 
                    bindingNamespace="@services.url@/XXXXService" 
                    contract="WF.XXX.WebServices.XXXXService" /&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="true"/&gt;
            &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
            &lt;serviceCredentials&gt;
              &lt;clientCertificate&gt;
                &lt;authentication certificateValidationMode="None" mapClientCertificateToWindowsAccount="true" /&gt;
              &lt;/clientCertificate&gt;
            &lt;/serviceCredentials&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt;
    &lt;/system.serviceModel&gt;
  </code></pre>