“无法导入 wsdl:绑定”尝试添加 silverlight 服务时出错
我在尝试向 silverlight 4 添加新的 Web 服务时收到此错误。我已在数据访问对象层中打开客户端,并准备好业务逻辑来调用该服务。显示的错误输出与 Windows 批处理文件运行相关,该文件应该生成调用新 Web 服务所需的文件。我到处寻找解决方案,并尝试将服务引用类型更改为通用列表,并按照另一个解决方案的指示取消选中“通用程序集中的重用类型”(通过右键单击解决方案资源管理器中的服务引用实例找到的复选框)在 VS 2010 中选择服务参考设置。) 错误:无法导入 wsdl:绑定 和错误:无法导入 wsdl:porttype 不断出现。 任何意见将不胜感激。
尝试使用 WS-Metadata Exchange 或 DISCO 从“http://localhost:64903/Services/ServiceWcfS.svc”下载元数据。
错误:无法导入 wsdl:portType
详细信息:运行 WSDL 导入扩展时引发异常:
System.ServiceModel.Description.DataContractSerializerMessageContractImporter 错误:无法导入命名空间“http://schemas.datacontract.org/2004/07/System.ComponentModel”中数据协定名称“PropertyChangedEventHandler”的 ISerialized 类型。无法为 ISerialized 类型自定义数据协定命名空间,并且生成的命名空间“AccessPoint.WcfServices.ServiceWcfS”与所需的 CLR 命名空间“System.ComponentModel”不匹配。检查所需的命名空间是否已映射到不同的数据协定命名空间,并考虑使用命名空间集合显式映射它。
错误源的 XPath: //wsdl:definitions[@targetNamespace='http://tempuri.org']/wsdl:portType[@name='IServiceWcfS']错误:无法导入 wsdl:binding
详细信息:导入 wsdl:binding 所依赖的 wsdl:portType 时出错。
wsdl:portType 的 XPath://wsdl:definitions[@targetNamespace='http://tempuri.org']/wsdl:portType[@name='IServiceWcfS']
错误源的 XPath://wsdl:definitions[@targetNamespace='http://tempuri.org']/wsdl:binding[@name='BasicHttpBinding_IServiceWcfS']
错误:无法导入 wsdl:port
详细信息:导入 wsdl:port 所依赖的 wsdl:binding 时出错。
wsdl:binding 的 XPath://wsdl:definitions[@targetNamespace='http://tempuri.org']/wsdl:binding[@name='BasicHttpBinding_IServiceWcfS']
错误源的 XPath://wsdl:definitions[@targetNamespace='http://tempuri.org']/wsdl:service[@name='ServiceWcfS']/wsdl:port[@name='BasicHttpBinding_IServiceWcfS' ]
错误:未找到与 Silverlight 4 兼容的端点。生成的客户端类不会 除非通过构造函数提供端点信息,否则可用。
I am receiving this error when attempting to add a new web service to silverlight 4. I have opened the client in the Data access object layer and have the business logic in place to call the service. The error output shown is relating to a windows batch file run which is supposed to generate the files necessary to call the new web service. I have looked everywhere for a solution and i have tried changing the service reference type to a generic list and unchecked the "reuse types in generic assemblies" as instructed from another solution ( checkbox located by right clicking the service reference instance in the solution explorer and selecting service reference settings in VS 2010.)
The error:cannot import wsdl:binding and error: cannot import wsdl:porttype keep showing up.
Any input woulb be greatly appreciated.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道有点晚了,但我认为您的错误就在这里:
PropertyChangedEventHandler
是委托类型,因此不可序列化,找到正在使用它的内容(数据协定或服务方法)并删除它。I know it's a bit late but I think your error is right here:
PropertyChangedEventHandler
is a delegate type and is therefore not serializable, find what is using it (either a data contract or a service method) and remove it.