微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – 尝试添加silverlight服务时出现“无法导入wsdl:binding”错误

我在尝试向Silverlight 4添加新的Web服务时收到此错误.我已在数据访问对象层中打开客户端并具有调用服务的业务逻辑.显示错误输出Windows批处理文件运行有关,该运行应该生成调用新Web服务所需的文件.我已经到处寻找解决方案,我已经尝试将服务引用类型更改为通用列表,并根据另一个解决方案的指示取消选中“在通用程序集中重用类型”(通过右键单击解决方案资源管理器中的服务引用实例来定位复选框)在VS 2010中选择服务参考设置.)
错误:无法导入wsdl:binding和错误:无法导入wsdl:porttype继续显示.
任何输入都会非常感激.

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 @R_782_4045@ion is provided via the constructor.

解决方法

我知道有点晚了,但我认为你的错误在这里

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

PropertyChangedEventHandler是委托类型,因此不可序列化,查找正在使用它的内容(数据协定或服务方法)并将其删除.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐