我在尝试向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 information is provided via the constructor.
我知道有点晚了,但我认为你的错误就在这里:
System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: ISerializable type with data contract name 'PropertyChangedEventHandler' in namespace...
PropertyChangedEventHandler是委托类型,因此不可序列化,查找正在使用它的内容(数据协定或服务方法)并将其删除.