[英]WCF Service that returns a custom class generates errors in Reference.cs
[英]MonoTouch WCF Service Reference.cs Errors
我有一個非常簡單的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);
}
這是Mono的WSDL生成中的錯誤。
我使用Visual Studio 2012 Web Express為此創建了一個簡單的測試用例 ,當從Windows計算機復制Reference.cs文件時,它工作正常。
現在,此問題已在mono / master commit aa2e9ec中修復 。
該錯誤會影響具有復雜返回類型的所有無參數服務方法。
作為臨時的解決方法, SlSvcUtil.exe
在Windows上使用SlSvcUtil.exe
創建客戶端代理或向服務方法中添加虛擬參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.