wcf restful service not working on winhost

Discussion in 'Site Programming, Development and Design' started by jmcfet, Sep 4, 2010.

  1. I am trying to host a WCF Restful service on Winhost without success as I am getting a following error:

    The server encountered an error processing the request. See server logs for more details.

    Upon inspection with Fiddler I get more details:

    System.ServiceModel.CommunicationException: Unrecognized message version

    Now this service runs great on my local IIS where I have a virtual directory mapped to WCFRestPushSvc directory that contains my
    svc file. Note this is a Restful service so my web.config only contains

    <system.web>
    <compilation debug="true" targetFramework="4.0" />
    </system.web>

    <system.serviceModel>
    <diagnostics>
    <messageLogging logEntireMessage="true" logMalformedMessages="true"
    logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"
    maxMessagesToLog="3000" maxSizeOfMessageToLog="10000" />
    </diagnostics>
    </system.serviceModel>
    <system.diagnostics>
    <sources>
    <source name="System.ServiceModel"
    switchValue="Information, ActivityTracing"
    >
    <listeners>
    <add name="traceListener"
    type="System.Diagnostics.XmlWriterTraceListener"
    initializeData= "E:\web\silvercl\Traces.svclog" />
    </listeners>
    </source>
    </sources>
    </system.diagnostics>


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

    </configuration>

    Most of this is for tracing as u can see and I am targeting .net 4
    my Servicehost looks like:
    <%@ ServiceHost Language="C#" Debug="true" Service="WCFRestPushSvc.PushService" CodeBehind="PushService.svc.cs" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>

    and my servicecontract:
    [ServiceContract]
    public interface IPushService
    {

    [OperationContract, WebGet]
    void SetQuoteInfo(string info);

    [OperationContract, WebGet]
    void Register(string uri);

    [OperationContract, WebGet]
    void Unregister(string uri);
    // TODO: Add your service operations here
    }

    Following your documents I created a Application Starting point that looks like:
    /wcfrestpushsvc/wcfrestpushsvc

    I just FTP'd my whole project from my machine to Winhost and this was my structure locally thus the double wcfrestpushsvc.

    To test this I type in from IE 8: http://silverclouddevelopment.com/WCFRestPushSvc/WCFRestPushSvc/PushService.svc/register?uri=foo.com

    One my local IIS this results in the register method being called but on Winhost I an throwing the exception. I cannot imagine
    that I missing any dependancys as I copied the whole project and I set the asp.net version in your control panel to 4

    I should also mention that the WCF trace file is empty

    Thanks
     
    Last edited by a moderator: Oct 14, 2015
  2. I changed my web.config to following and things are working :

    <configuration>

    <system.web>
    <compilation debug="true" targetFramework="4.0" />
    </system.web>

    <system.serviceModel>
    <behaviors>
    <serviceBehaviors>
    <behavior>
    <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
    <serviceMetadata httpGetEnabled="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>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <diagnostics>
    <messageLogging logEntireMessage="true" logMalformedMessages="true"
    logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"
    maxMessagesToLog="3000" maxSizeOfMessageToLog="10000" />
    </diagnostics>
    </system.serviceModel>
    <system.diagnostics>
    <sources>
    <source name="System.ServiceModel"
    switchValue="Information, ActivityTracing"
    >
    <listeners>
    <add name="traceListener"
    type="System.Diagnostics.XmlWriterTraceListener"
    initializeData= "E:\web\silvercl\Traces.svclog" />
    </listeners>
    </source>
    </sources>
    </system.diagnostics>


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

    </configuration>
     
  3. Thanks for following up. Glad it's working for you now.
     

Share This Page