title: the type '*', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element * could not be found
body: <p>I have a provider hosted app in sharepoint which works locally without problem. I followed this tutorial to publish it to azure </p>
  
  <p><a href="http://blogs.technet.com/b/sharepointdevelopersupport/archive/2013/09/05/how-to-deploy-a-provider-hosted-app-as-an-azure-site.aspx" rel="nofollow">http://blogs.technet.com/b/sharepointdevelopersupport/archive/2013/09/05/how-to-deploy-a-provider-hosted-app-as-an-azure-site.aspx</a></p>
  
  <p>However after publishing the webservice doesnt work I get this exception:</p>
  
  <pre><code>[InvalidOperationException: The type 'x.IntranetWeb.Services.AppEventReceiver', 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.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +62739
     System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1429
     System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +52
     System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +598
  
  [ServiceActivationException: The service '/Services/AppEventReceiver.svc' cannot be activated due to an exception during compilation.  The exception message is: The type 'x.IntranetWeb.Services.AppEventReceiver', 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) +486572
     System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +174
     System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +345998
     System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +9683593
  </code></pre>
  
  <p>My web.config which I didnt touch.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=301880
    --&gt;
  &lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;add key="webpages:Version" value="3.0.0.0" /&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
      &lt;add key="ClientValidationEnabled" value="true" /&gt;
      &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;
      &lt;add key="ClientId" value="xx-04e7-4caf-854a-89c20577d7da" /&gt;
      &lt;add key="ClientSecret" value="ljguTvxHR+xx+Pl1IMg1Hjt5rsQ=" /&gt;
    &lt;/appSettings&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.5" /&gt;
      &lt;httpRuntime targetFramework="4.5" /&gt;
      &lt;customErrors mode="Off"/&gt;
    &lt;/system.web&gt;
    &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-5.2.0.0" newVersion="5.2.0.0" /&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;basicHttpBinding&gt;
          &lt;!--Used by app for SharePoint--&gt;
          &lt;binding name="secureBinding"&gt;
            &lt;security mode="Transport" /&gt;
          &lt;/binding&gt;
        &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;protocolMapping&gt;
        &lt;add binding="basicHttpBinding" scheme="https" bindingConfiguration="secureBinding" /&gt;
      &lt;/protocolMapping&gt;
    &lt;/system.serviceModel&gt;
    &lt;system.webServer&gt;
      &lt;handlers&gt;
        &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt;
        &lt;remove name="OPTIONSVerbHandler" /&gt;
        &lt;remove name="TRACEVerbHandler" /&gt;
        &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /&gt;
      &lt;/handlers&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>and a piece of the code of the remote event receiver</p>
  
  <pre><code>&lt;%@ ServiceHost Language="C#" Debug="true" Service="x.IntranetWeb.Services.AppEventReceiver" CodeBehind="AppEventReceiver.svc.cs" %&gt;
  
  
  namespace x.IntranetWeb.Services
  {
      public class AppEventReceiver : IRemoteEventService
      {
  </code></pre>
  
  <p>and the global.asax, as this is an MVC application with a .svc on it, maybe it has something to do with routing?</p>
  
  <pre><code>public class MvcApplication : System.Web.HttpApplication
      {
          protected void Application_Start()
          {
              AreaRegistration.RegisterAllAreas();
              FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
              RouteConfig.RegisterRoutes(RouteTable.Routes);
              BundleConfig.RegisterBundles(BundleTable.Bundles);
          }
      }
  </code></pre>