2012-02-20 102 views
4

嘗試向Silverlight 4添加新的Web服務時收到此錯誤。我已經在數據訪問對象層中打開了客戶端並擁有業務邏輯準備致電該服務。顯示的錯誤輸出與Windows批處理文件運行有關,該批處理文件運行應該生成調用新的Web服務所必需的文件。我已到處尋找解決方案,並試圖將服務引用類型更改爲通用列表,並取消選中另一個解決方案中指示的「通用程序集中的重用類型」(通過在解決方案資源管理器中右鍵單擊服務引用實例在VS 2010中選擇服務參考設置。) 錯誤:無法導入wsdl:binding和錯誤:無法導入wsdl:porttype繼續顯示。任何輸入woulb將不勝感激。嘗試添加silverlight服務時出現「無法導入wsdl:binding」錯誤

Attempting to download metadata from 'http://localhost:64903/Services/ServiceWcfS.svc' using WS-Metadata Exchange or DISCO.

Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension:
System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: ISerializable type with data contract name 'PropertyChangedEventHandler' in namespace 'http://schemas.datacontract.org/2004/07/System.ComponentModel' cannot be imported. The data contract namespace cannot be customized for ISerializable types and the generated namespace 'AccessPoint.WcfServices.ServiceWcfS' does not match the required CLR namespace 'System.ComponentModel'. Check if the required namespace has been mapped to a different data contract namespace and consider mapping it explicitly using the namespaces collection.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org']/wsdl:portType[@name='IServiceWcfS']

Error: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://tempuri.org']/wsdl:portType[@name='IServiceWcfS']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org']/wsdl:binding[@name='BasicHttpBinding_IServiceWcfS']

Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://tempuri.org']/wsdl:binding[@name='BasicHttpBinding_IServiceWcfS']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org']/wsdl:service[@name='ServiceWcfS']/wsdl:port[@name='BasicHttpBinding_IServiceWcfS']

Error: No endpoints compatible with Silverlight 4 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.

回答

1

我知道這是一個有點晚了,但我認爲你的錯誤就在這裏:

System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: ISerializable type with data contract name 'PropertyChangedEventHandler' in namespace... 

PropertyChangedEventHandler是一個委託類型,因此不序列化,查找正在使用它(數據合同或服務方法)並將其刪除。

相關問題