2012-04-16 104 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

相關問題