Question

I'm getting the error mentioned in the title and not sure what exactly I may be doing wrong. I'm running Mono 2.10.6 on openSUSE. The issue only happens when I try to browse to the WCF service (web pages load fine).

Service code is:

namespace CyberLane
{
    [ServiceContract]
    public class DataServices// : IDataServices
    {
        [OperationContract]
        public TweetDTO[] GetLatestTweets()
        {
            return MasterRepository.GetTweets().Select(x => new TweetDTO(x)).ToArray();
        }
    }
}

my Web.config has the following:

<system.serviceModel>
    <behaviors>
        <endpointBehaviors>
            <behavior name="CyberLane.DataServicesAspNetAjaxBehavior">
                 <enableWebScript />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
        <service name="CyberLane.DataServices">
            <endpoint address="" behaviorConfiguration="CyberLane.DataServicesAspNetAjaxBehavior" binding="webHttpBinding" contract="CyberLane.DataServices" />
        </service>
    </services>
</system.serviceModel>

Please ask me if you need more information, and I'll be more than happy to share! This has been driving me crazy for a couple weeks now.

Was it helpful?

Solution

First, the best practice and common approach is to decorate IDataServices (interface) with ServiceModel attributes, not a class implementing it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top