[英]MonoTouch WCF Service Reference.cs Errors
I have a very simple WCF Service it has a single method GetDateTime(), I have it hosted in IIS on Windows 7, all seems to working fine in the windows environment, I can execute using test client application. 我有一个非常简单的WCF服务,它只有一个方法GetDateTime(),我将它托管在Windows 7上的IIS中,在Windows环境中一切似乎都可以正常工作,我可以使用测试客户端应用程序来执行。
On my Mac using MonoTouch I have added a web reference to the Service, it finds the service and generates a whole lot of files. 在使用MonoTouch的Mac上,我已对服务添加了Web引用,它可以找到服务并生成大量文件。
When I compile the Mono project there is an error in the Reference.cs file that has been generated. 当我编译Mono项目时,Reference.cs文件中已生成错误。
The GetDateTime Method in the interface has been declared with a return type GetDateTimeResponse instead of System.DateTime. 接口中的GetDateTime方法已使用返回类型GetDateTimeResponse而不是System.DateTime声明。
Any idea what has gone wrong is this a bug or have I missed something? 知道这出了什么问题是错误的,还是我错过了什么?
[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);
}
This is a bug in Mono's WSDL generation. 这是Mono的WSDL生成中的错误。
I created a simple test case for this, using Visual Studio 2012 Web Express, and it is working fine when copying the Reference.cs file from the Windows machine. 我使用Visual Studio 2012 Web Express为此创建了一个简单的测试用例 ,当从Windows计算机复制Reference.cs文件时,它工作正常。
This is now fixed in mono/master commit aa2e9ec . 现在,此问题已在mono / master commit aa2e9ec中修复 。
The bug affects all parameterless service methods with complex return types. 该错误会影响具有复杂返回类型的所有无参数服务方法。
As a temporary workaround, use SlSvcUtil.exe
on Windows to create the client proxy or add a dummy parameter to your service method. 作为临时的解决方法,
SlSvcUtil.exe
在Windows上使用SlSvcUtil.exe
创建客户端代理或向服务方法中添加虚拟参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.