1

我正在使用带有 Silverlight 5 框架的 Windows 7 和 Visual Studio .NET 2010。

我正在使用来自YouTube的视频教程,介绍如何使用 Web 服务创建 Windows 手机应用程序。

问题是,当我添加 Web 服务“http://msrmaps.com/TerraService2.asmx”时,一旦添加了服务引用,我就会得到很多我不明白的错误。

我按如下方式调用 Web 服务:

  1. 在解决方案资源管理器中,右键单击并选择“添加服务引用”
  2. 将上面的 URL 粘贴到地址框中
  3. 点击前往
  4. 接受提供的命名空间或为命名空间键入另一个有效名称。在我的案例中,我将其命名为 TerraService。
  5. 构建项目。

警告和错误

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://msrmaps.com/']/wsdl:portType[@name='TerraServiceSoap']   c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap

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://msrmaps.com/']/wsdl:portType[@name='TerraServiceSoap']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://msrmaps.com/']/wsdl:binding[@name='TerraServiceSoap']    c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap

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://msrmaps.com/']/wsdl:binding[@name='TerraServiceSoap']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://msrmaps.com/']/wsdl:service[@name='TerraService']/wsdl:port[@name='TerraServiceSoap']    c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap

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.  c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap

Warning 5   Custom tool warning: Exception has been thrown by the target of an invocation.  c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap

Error   6   Custom tool error: Failed to generate code for the service reference 'TerraService'.  Please check other error and warning messages for details.    c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap

我如何摆脱这些警告和错误。这是什么原因造成的?

4

1 回答 1

1

我找到了解决这个问题的方法。我只是将我的 Windows Phone SDK 更新到了最新版本。最新版本可以在这里找到。下载最新的更新安装程序。保存您的解决方案并关闭 Visual Studio。使用下载的文件更新您的 Windows Phone SDK。一旦完成。再次打开您的 Visual Studio。它会顺利工作。

于 2012-06-02T14:59:59.083 回答