缺少CookComputing.XmlRpc和重复定义的功能

时间:2017-09-08 14:39:10

标签: c# python .net client xml-rpc

我在一个分布式应用程序上工作,我的服务器用python编程语言编写,客户端用C#编写。为了与客户端和服务器进行通信,我选择使用xml-rpc。我已经在python上编写了我的服务器,但是当我开始使用CookComputing.XmlRpc(我添加了引用)库来编写我的C#客户端时,官方文档中提供的示例中提供的许多功能都不存在而其他一些是重复的这困扰了编译器。 这是代码:

using CookComputing.XmlRpc;

public struct SumAndDiffValue 
{
   public int sum; 
   public int difference; 
}

[XmlRpcUrl("http://www.cookcomputing.com/sumAndDiff.rem")] 
public interface ISumAndDiff : IXmlRpcProxy
{ 
   [XmlRpcMethod] 
   SumAndDiffValue SumAndDifference(int x, int y);
}    

我收到了这个错误:

The type or namespace name 'XmlRpcUrl' could not be found (are you missing a using directive or an assembly reference?)

The type 'CookComputing.XmlRpc.XmlRpcUrlAttribute' exists in both 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\CookComputing.XmlRpcV2.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\CookComputing.XmlRpcSilverlight.dll'    

The type 'CookComputing.XmlRpc.IXmlRpcProxy' exists in both 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\CookComputing.XmlRpcV2.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\CookComputing.XmlRpcSilverlight.dll'

The type or namespace name 'XmlRpcMethod' could not be found (are you missing a using directive or an assembly reference?)  

The type 'CookComputing.XmlRpc.XmlRpcMethodAttribute' exists in both 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\CookComputing.XmlRpcV2.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\CookComputing.XmlRpcSilverlight.dll' 

我在做什么?

1 个答案:

答案 0 :(得分:0)

似乎我在从xml-rpc.net安装新dll时犯了一个错误,为了避免这个问题,最好通过nuget使用此命令安装它:

Install-Package xmlrpcnet -Version 2.5.0