'normal' SVC versus 'Silverlight' SVC (WCF)

Posted by Michel on Stack Overflow See other posts from Stack Overflow or by Michel
Published on 2010-04-27T08:21:20Z Indexed on 2010/04/27 8:23 UTC
Read the original article Hit count: 534

Filed under:
|
|

Hi,

i'm trying to call a WCF service from my Silverlight 3 app. But... when trying to create a 'silverlight enabled wcf service' in my web project, my VS2008 crashes during creating the item (i think while editing the web.config).

So i thought: let's create a 'normal' wcf service, and manually edit it to be a 'silverlight enabled webservice'.

So i wondered what the differences are, and second: why is there a difference between a service called from a silverlight app and a non-silverlight app?

This is what i have now for the binding (i have a service without an Interface contract, just a direct class exposed, to begin with):

<system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="RadControlsSilverlightApp1.Web.GetNewDataBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <bindings>
            <customBinding>
                <binding name="customBinding0">
                    <binaryMessageEncoding />
                    <httpTransport />
                </binding>
            </customBinding>
        </bindings>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <services>
            <service behaviorConfiguration="RadControlsSilverlightApp1.Web.GetNewDataBehavior"
             name="RadControlsSilverlightApp1.Web.GetNewData">
                <endpoint address="" binding="customBinding" bindingConfiguration="customBinding0"
                 contract="RadControlsSilverlightApp1.Web.GetNewData" />
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            </service>
        </services>

    </system.serviceModel>

This one doesn't work because when i add a reference to it from the silverlight app i get these messages:

Warning 2   Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Exception has been thrown by the target of an invocation.
XPath to Error Source: //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='GetNewData']    C:\Silverlight\RadControlsSilverlightApp1\RadControlsSilverlightApp1\Service References\ServiceReference1\Reference.svcmap  1   1   RadControlsSilverlightApp1
Warning 3   Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='GetNewData']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='CustomBinding_GetNewData']    C:\Silverlight\RadControlsSilverlightApp1\RadControlsSilverlightApp1\Service References\ServiceReference1\Reference.svcmap  1   1   RadControlsSilverlightApp1
Warning 4   Custom tool warning: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='CustomBinding_GetNewData']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='GetNewData']/wsdl:port[@name='CustomBinding_GetNewData']  C:\Silverlight\RadControlsSilverlightApp1\RadControlsSilverlightApp1\Service References\ServiceReference1\Reference.svcmap  1   1   RadControlsSilverlightApp1
Warning 5   Custom tool warning: No endpoints compatible with Silverlight 3 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.  C:\Silverlight\RadControlsSilverlightApp1\RadControlsSilverlightApp1\Service References\ServiceReference1\Reference.svcmap  1   1   RadControlsSilverlightApp1

(ps., the service can be started in the browser, i get this:

svcutil.exe http://localhost:9599/GetNewData.svc?wsdl

)

© Stack Overflow or respective owner

Related posts about silverlight-3.0

Related posts about Silverlight