2010-08-23 36 views
0

我的一個WCF服務正在返回一個XElement對象。 Visual Studio中,客戶端的web應用程序,是保持表示該代碼段WCF的XElement - 奇怪的錯誤

XElement xml = xmlService.Get(); 

這兩個應用程序都在同一計算機上上述

Cannot convert source type 'System.Xml.Linq.XElement[Service.Contracts, Version=1.0.0.0, Culture=neutral]' to target type 'System.Xml.Linq.XElemnet[System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]'

此消息。該項目編譯得很好,沒有顯示錯誤,但它很煩人。可能是什麼問題呢 ?

順便說一句我應該返回一個字符串並解析它嗎?

+0

Web服務的重點在於,您不必進入系統的底層,並且可以分析和解析XML ......爲什麼不傳遞定義良好的對象(並讓運行時處理所有的(de)序列化細節)?? – 2010-08-23 08:19:53

+0

它是有道理的,你說關於發送字符串和解析它,但錯誤呢? XElement實現IXmlSerializable。 – user137348 2010-08-23 08:25:11

+0

檢查您的服務引用是否重用了System.Xml.Linq程序集。 – 2010-08-23 08:45:06

回答

0

電腦重新啓動後,它再次正常工作。