Compiled WCF Service Returning Exception

Discussion in 'Site Programming, Development and Design' started by ekiinet0, May 29, 2012.

  1. My WCF Service ASP 4.0 using SSL works well in uncompiled form on Winhost, and works in compiled form on local IIS7. Copying files from IIS7 to Winhost (web.config unchanged) results in the following exception:

    System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

    Any help greatly appreciated

    web.config is below:

    <?xml version="1.0"?>
    <configuration>

    <system.web>
    <compilation debug="false" targetFramework="4.0" defaultLanguage="c#" batch="false" />
    </system.web>

    <system.serviceModel>

    <bindings>
    <wsHttpBinding>
    <binding name="TransportSecurity">
    <security mode="Transport">
    <transport clientCredentialType="None" ></transport>
    </security>
    </binding>
    </wsHttpBinding>
    </bindings>

    <services>
    <service name="Service" >

    <!-- Service Endpoints -->
    <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="TransportSecurity" contract="IService"/>
    <!-- delete next line to prevent exposing service.svc -->
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
    </service>
    </services>

    <behaviors>
    <serviceBehaviors>
    <behavior>
    <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
    <serviceMetadata httpsGetEnabled="true"/>
    <!-- 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 -->
    <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>

    <!-- aspnetCom..Enabled=true added to access Global.asax -->
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />

    </system.serviceModel>

    <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    </system.webServer>

    </configuration>
     
    Last edited by a moderator: Oct 14, 2015
  2. Solved my own problem

    Used -u switch with aspnet_compiler. Seems to solve the problem.

    Without -u Sevice.svc becomes a placeholder and \bin contains a .compiled form of service.svc. With -u Service.svc remains the same as uncompiled form and no .compiled file created.

    Works for me
     
  3. Thanks for posting the follow up. You'll save someone a headache.
     

Share This Page