欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Windows Phone&添加service reference出错

程序员文章站 2023-02-20 08:51:46
最近几天在学习windows phone7的开发,在做location service时遇到一个问题,就是添加一个service reference(我添加的是http://msrmaps.com/...

最近几天在学习windows phone7的开发,在做location service时遇到一个问题,就是添加一个service reference(我添加的是http://msrmaps.com/terraservice2.asmx,大家应该都熟悉,不会有什么问题)后,出现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'] e:\asp.net\visual studio 2010\projects\xapnote\xapnote\service references\myterraservice\reference.smap 1 1 xapnote


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'] e:\asp.net\visual studio 2010\projects\xapnote\xapnote\service references\myterraservice\reference.svcmap 1 1 xapnote


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'] e:\asp.net\visual studio 2010\projects\xapnote\xapnote\service references\myterraservice\reference.svcmap 1 1 xapnote

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. e:\asp.net\visual studio 2010\projects\xapnote\xapnote\service references\myterraservice\reference.svcmap 1 1 xapnote


warning 5 custom tool warning: exception has been thrown by the target of an invocation. e:\asp.net\visual studio 2010\projects\xapnote\xapnote\service references\myterraservice\reference.svcmap 1 1 xapnote


error 6 custom tool error: failed to generate code for the service reference 'myterraservice'. please check other error and warning messages for details. e:\asp.net\visual studio 2010\projects\xapnote\xapnote\service references\myterraservice\reference.svcmap 1 1 xapnote

 

解决办法:

添加service reference 的时候选择advanced

select generic.list for collection type, uncheck the reuse types in reference assemblies and the compilation is succesfull

希望帮助到别人

 

 

摘自 linxuewei的专栏