WCF:添加服务引用不生成客户端代理代码

发布于 2024-12-19 23:00:19 字数 2642 浏览 5 评论 0原文

我正在尝试使用 Visual Studio 2010 Express

来演练这个项目http://www.codeproject.com/KB/windows-phone-7/Text_to_speech_in_wp7.aspx?display=Print

测试 Windows 7 手机文本到语音。当我添加对所有内容的引用时

http://api.microsofttranslator.com/V2/Soap.svc

似乎有效。但是,我没有获得客户端代理代码。 Reference.cs 为空,Visual Studio 出现以下警告和错误:

警告 1 自定义工具警告:无法导入 wsdl:portType 详细信息:运行 WSDL 导入扩展时引发异常:System.ServiceModel.Description.DataContractSerializerMessageContractImporter 错误:无法从程序集“System.Runtime.Serialization,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e”加载类型“System.Runtime.Serialization.DataContractSet”。 错误源的 XPath: //wsdl:definitions[@targetNamespace='http://api.microsofttranslator.com/V2']/wsdl:portType[@name='LanguageService'] D:\Documents\Visual Studio 2010\Projects \TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

警告 2 自定义工具警告:无法导入 wsdl:binding 详细信息:导入 wsdl:binding 所依赖的 wsdl:portType 时出错。 wsdl:portType 的 XPath: //wsdl:definitions[@targetNamespace='http://api.microsofttranslator.com/V2']/wsdl:portType[@name='LanguageService'] 错误源的 XPath: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_LanguageService'] D:\Documents\Visual Studio 2010\Projects\TrackMe\ TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

警告 3 自定义工具警告:无法导入 wsdl:port 详细信息:导入 wsdl:port 所依赖的 wsdl:binding 时出错。 wsdl:binding 的 XPath: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_LanguageService'] 错误源的 XPath: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='SoapService']/wsdl:port[@name='BasicHttpBinding_LanguageService'] D :\Documents\Visual Studio 2010\Projects\TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 追踪我

警告 4 自定义工具警告:未找到与 Silverlight 3 兼容的端点。除非通过构造函数提供端点信息,否则生成的客户端类将不可用。 D:\Documents\Visual Studio 2010\Projects\TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

警告 5 自定义工具警告:调用目标已引发异常。 D:\Documents\Visual Studio 2010\Projects\TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

错误 6 自定义工具错误:无法为服务引用“MicrosoftTranslator”生成代码。请检查其他错误和警告消息以了解详细信息。 D:\Documents\Visual Studio 2010\Projects\TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

取消选中“引用程序集中的重用类型”也没有帮助。

以前有人遇到过这个吗?

I am trying to walk through this project sing Visual Studio 2010 Express

http://www.codeproject.com/KB/windows-phone-7/Text_to_speech_in_wp7.aspx?display=Print

to test Windows 7 phone text to speech. When I add a reference to

http://api.microsofttranslator.com/V2/Soap.svc

all seems to work. However, I do not get client proxy code. Reference.cs is empty and Visual Studio presents the following warnings and errors:

Warning 1 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Could not load type 'System.Runtime.Serialization.DataContractSet' from assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://api.microsofttranslator.com/V2']/wsdl:portType[@name='LanguageService'] D:\Documents\Visual Studio 2010\Projects\TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

Warning 2 Custom tool warning: 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://api.microsofttranslator.com/V2']/wsdl:portType[@name='LanguageService']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_LanguageService'] D:\Documents\Visual Studio 2010\Projects\TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

Warning 3 Custom tool warning: 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_LanguageService']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='SoapService']/wsdl:port[@name='BasicHttpBinding_LanguageService'] D:\Documents\Visual Studio 2010\Projects\TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

Warning 4 Custom tool warning: No endpoints compatible with Silverlight 3 were found. The generated client class will not be usable unless endpoint information is provided via the constructor. D:\Documents\Visual Studio 2010\Projects\TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

Warning 5 Custom tool warning: Exception has been thrown by the target of an invocation. D:\Documents\Visual Studio 2010\Projects\TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

Error 6 Custom tool error: Failed to generate code for the service reference 'MicrosoftTranslator'. Please check other error and warning messages for details. D:\Documents\Visual Studio 2010\Projects\TrackMe\TrackMe\Service References\MicrosoftTranslator\Reference.svcmap 1 1 TrackMe

Unchecking 'Reuse types in referenced assemblies" does not help either.

Anyone run into this before?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文