2012-04-16 103 views
0

当试图实现两个点之间的查找路径,我用this article,但它会产生一个错误:错误:类型或命名空间找不到

类型或命名空间名称findroute”找不到(是否缺少using指令或程序集引用?)

using findroute.geocodeservice; 
    private void Geocode(string strAddress, int waypointIndex) 
    { 
     // Here we create the service variable and set the callback method using the GeocodeCompleted property. 
     findroute.geocodeservice.GeocodeServiceClient geocodeService = new findroute.geocodeservice.GeocodeServiceClient("BasicHttpBinding_IGeocodeService"); 
     geocodeService.GeocodeCompleted += new EventHandler<findroute.geocodeservice.GeocodeCompletedEventArgs>(geocodeService_GeocodeCompleted); 
     // Here we Set the credentials and the geocode query,which could be an address or location. 
     findroute.geocodeservice.GeocodeRequest geocodeRequest = new findroute.geocodeservice.GeocodeRequest(); 
     geocodeRequest.Credentials = new Credentials(); 
     geocodeRequest.Credentials.ApplicationId = ((ApplicationIdCredentialsProvider)map1.CredentialsProvider).ApplicationId; 
     geocodeRequest.Query = strAddress; 
     // Now Making the asynchronous Geocode request, using the 'waypoint index' as 
     // the user state to track this request and allow it to be identified when the response is returned. 
     geocodeService.GeocodeAsync(geocodeRequest, waypointIndex); 
    } 

如何这个问题能解决?

+0

这听起来像他正在创建的项目的核心命名空间。尝试你的核心命名空间而不是'findroute'。 – Tejs 2012-04-16 21:36:13

+0

100%true .. thnx ...我觉得很残留..^_^ – bebadbutneverbesad 2012-04-16 22:21:16

回答

5

你是否按照这一点的说明?

  • 转到解决方案资源管理
  • 另外添加一个服务引用 - >右键单击参考

  • 添加服务引用

  • 在地址栏中类型 - http://dev.virtualearth.net/webservices/v1/routeservice/routeservice.svc/mex。这是在应用程序中使用路径相关的类。将此服务参考命名为routeservice

  • 添加另一个服务参考http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc/mex。这是在应用程序中使用地理编码相关的类。将此服务参考命名为geocodeservice

这可能是考虑到实际名字是findroute.routeservice,而不是仅仅routeservice,但是这基本上就是它的寻找 - 与你使用的任何名称相应地调整你的代码。

+0

我把文章逐步流程 – bebadbutneverbesad 2012-04-16 21:52:17

+0

并执行服务引用...但仍然有这个错误...我真的需要一些帮助..因为这对我的毕业计划很重要......请如果有任何这样的笑话文章,我可以使用... thanx ..^_ ^ – bebadbutneverbesad 2012-04-16 21:55:41

相关问题