我想从我的Silverlight 3应用程序调用WCF服务。 但是...当试图在我的web项目中创建'启用silverlight的wcf服务'时,我的VS2008在创建项目时(我认为在编辑web.config时)崩溃。'正常'SVC与'Silverlight'SVC(WCF)
所以我想:让我们创建一个'普通'wcf服务,并手动将其编辑为'启用silverlight的web服务'。
所以我想知道有什么区别,第二:为什么从Silverlight应用程序调用的服务和非Silverlight应用程序之间存在差异?
这是我现在有一个绑定(无我有一个接口协议的业务,恰恰暴露了直接的班,开始):
<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>
这一个不能正常工作,因为当我从Silverlight应用程序添加引用它,我得到的消息:
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,该服务可以在浏览器启动时,我得到这个:
svcutil.exe http://localhost:9599/GetNewData.svc?wsdl
)