MonoTouch WCF服务Reference.cs错误

时间:2012-09-23 09:14:29

标签: c# wcf xamarin.ios

我有一个非常简单的WCF服务它有一个方法GetDateTime(),我把它托管在Windows 7上的IIS中,一切似乎都在windows环境中运行良好,我可以使用测试客户端应用程序执行。

在使用MonoTouch的Mac上,我添加了一个Web服务引用,它找到了服务并生成了大量文件。

编译Mono项目时,Reference.cs文件中出现了一个错误。

接口中的GetDateTime方法已声明为返回类型GetDateTimeResponse而不是System.DateTime。

知道出了什么问题是这个错误还是我错过了什么?

[System.ServiceModel.ServiceContractAttribute(Namespace="LastPrice.win7pro")]
public interface ITest {

    [System.ServiceModel.XmlSerializerFormatAttribute()]
    [System.ServiceModel.OperationContractAttribute(Action="http://win7pro/ITest/GetDateTime", ReplyAction="http://win7pro/ITest/GetDateTimeResponse")]
    GetDateTimeResponse GetDateTime(GetDateTime GetDateTime);

    [System.ServiceModel.XmlSerializerFormatAttribute()]
    [System.ServiceModel.OperationContractAttribute(Action="http://win7pro/ITest/GetDateTime", ReplyAction="http://win7pro/ITest/GetDateTimeResponse", AsyncPattern=true)]
    System.IAsyncResult BeginGetDateTime(GetDateTime GetDateTime, System.AsyncCallback asyncCallback, object userState);

    GetDateTimeResponse EndGetDateTime(System.IAsyncResult result);
}

1 个答案:

答案 0 :(得分:1)

这是Mono的WSDL生成中的一个错误。

我使用Visual Studio 2012 Web Express为此创建了一个简单的test case,并且在从Windows计算机复制Reference.cs文件时工作正常。

现在已修复mono/master commit aa2e9ec

该bug会影响具有复杂返回类型的所有无参数服务方法。

作为临时解决方法,请在Windows上使用SlSvcUtil.exe创建客户端代理或向服务方法添加虚拟参数。

相关问题