我有一個使用 WCF 連接到 SOAP Web 服務的 Xamarin.Android 應用程式。我需要添加一個訊息檢查器,以便它可以在發送之前為所有請求提供標頭。應用檢查器的代碼如下:
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
clientRuntime.ClientMessageInspectors.Add(this);
}
該應用程式編譯并運行,但是當我呼叫這個 getter 時,ClientMessageInspectors我得到一個System.NotImplementedException:
在 System.ServiceModel.Dispatcher.ClientRuntime.get_ClientMessageInspectors () [0x00000] 在 /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher /ClientRuntime.cs:108 _
在檢查例外堆疊跟蹤中參考的 Mono 檔案后,我發現它ClientMessageInspectors沒有實作,而是MessageInspectors暴露了,當我嘗試在應用程式中使用 MessageInspectors 時,它無法編譯。
我能做些什么來解決這個問題?
uj5u.com熱心網友回復:
我設法通過洗掉包含共享代碼的專案并在解決方案中僅使用單個 Android 專案來修復它。之后,我從 Mono 添加了 System.ServiceModel 2.0.5 版,它運行良好。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/494790.html
