没有一个Silverlight项目消费RIA服务项目、Silverlight、RIA

2023-09-04 12:09:09 作者:嘴角那一抹浅笑╮

我们有一个使用RIA服务Silverlight项目。还有就是我想要的项目和web服务之间共享一些code。我得离开code其中是现在,也就是我不能共享code。

我认为将是很好的Web服务调用的RIA服务。它会坐在同一台服务器上。

我去了我的Web服务项目,并增加了服务引用RIA服务。我点击先进打勾的选项为它生成异步操作。

我认为这将是所有好走,但我得到了一些警告。它生成的客户端code的缺失与异步调用任何实际的code,并在app.config也是空的。下面是警告,

 警告2自定义工具警告:不能导入WSDL:绑定
详细信息:时出错导入WSDL:端口类型的WSDL:绑定依赖。
XPath来WSDL:端口类型://wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='CarServiceSoap']
XPath来误差源: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_CarServiceSoap'] C:\开发\ DOTNET的\干线\应用程序\ WcfServices \ CarTransmitter \ CarTransmitter.Core \服务引用\ CarService \ Reference.svcmap 1 CarTransmitter.Core

警告3自定义工具警告:不能导入WSDL:端口
详细信息:时出错导入WSDL:绑定的WSDL:端口依赖。
XPath来WSDL:绑定: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_CarServiceSoap']
XPath来误差源: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='CarService']/wsdl:port[@name='BasicHttpBinding_CarServiceSoap'] C:\开发\ DOTNET的\干线\应用程序\ WcfServices \ CarTransmitter \ CarTransmitter.Core \服务引用\ CarService \ Reference.svcmap 1 CarTransmitter.Core

警告1自定义工具警告:不能导入WSDL:端口类型
详细信息:一个异常,同时运行一个WSDL导入扩展抛出:System.ServiceModel.Description.DataContractSerializerMessageContractImporter
错误:引用类型CarData.Organisation,CarData,版本= 1.0.0.0,文化=中性公钥=空'数据合同名称'组织'的命名空间http://schemas.datacontract.org/2004/07/CarData 不能使用,因为它不匹配导入DataContract。需要从被引用类型中排除这种类型。
XPath来误差源://wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='CarServiceSoap'] C:\开发\ DOTNET的\干线\应用程序\ WcfServices \ CarTransmitter \ CarTransmitter.Core \服务引用\ CarService \ Reference.svcmap 1 CarTransmitter.Core
 

解决方案

汉化不完全,有相当多的再沿。我遇到的问题,现在保证一个新的问题。

的解决上述问题的方法是勾去掉选项'中引用的程序再利用的类型'。当您添加服务引用,单击高级按钮,你会得到选项中引用的组件重用类型。

反编译Silverlight项目

这是因为我分享一些code中的两个项目,我使用的,并试图再利用的对象我的共享code对我的身边。相反,我只是想它来为我的代理对象,而不是重复使用这些对象。

We have a silverlight project that uses RIA services. There is some code that I want to share between that project and a web service. I have to leave the code where it is now, i.e. I cannot share the code.

What I thought would be good is for the web service to call the RIA service. It will be sitting on the same server.

I went to my web service project, and added a service reference to the ria service. I clicked advanced and ticked the option for it to 'generate asynchronous operations'.

I thought it would be all good to go, but I got some warnings. The client code that it generated was missing any actual code relating to the asynchronous calls, and the app.config is also empty. Here are the warnings,

Warning 2   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='http://tempuri.org/']/wsdl:portType[@name='CarServiceSoap']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_CarServiceSoap'] C:\Develop\DotNet\Trunk\Applications\WcfServices\CarTransmitter\CarTransmitter.Core\Service References\CarService\Reference.svcmap  1   1   CarTransmitter.Core

Warning 3   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='BasicHttpBinding_CarServiceSoap']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='CarService']/wsdl:port[@name='BasicHttpBinding_CarServiceSoap']   C:\Develop\DotNet\Trunk\Applications\WcfServices\CarTransmitter\CarTransmitter.Core\Service References\CarService\Reference.svcmap  1   1   CarTransmitter.Core

Warning 1   Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Referenced type 'CarData.Organisation, CarData, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' with data contract name 'Organisation' in namespace 'http://schemas.datacontract.org/2004/07/CarData' cannot be used since it does not match imported DataContract. Need to exclude this type from referenced types.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='CarServiceSoap'] C:\Develop\DotNet\Trunk\Applications\WcfServices\CarTransmitter\CarTransmitter.Core\Service References\CarService\Reference.svcmap  1   1   CarTransmitter.Core

解决方案

Not finished completely, got quite a bit further along. The problems I am having now warrant a new question.

The solution to the above problem is to untick the option 'reuse types in referenced assemblies'. When you add service reference, you click the advanced button and you get the option 'reuse types in referenced assemblies'.

This is because I am sharing some code between the two projects I am using, and it was trying to 'reuse' objects I had on my side in the shared code. Instead I just wanted it to create proxy objects for me and not reuse those objects.