2013-08-05 5 views
0

왜 마지막 두 URI 템플릿이 끝 점이 없음을 알 수 있습니까?8 개의 WCF REST 끝점 중 2 개에 대한 가능한 원인을 찾을 수 없습니까?

v1/version 
v1/locations/{id} 
v1/locations/{id}/signals 
v1/locations&q={searchText} 
v1/locations/signals/{signalIds} 
v1/signals/{id} 
v1/locations/{id}/visits 
v1/locations/{locationId}/visits/{id} 

모든 이전의 6 개 노선들은 잘 작동하지만 마지막 두 경로를 추가 할 때, 그들은 404 "엔드 포인트를 찾을 수 없습니다"WCF 프레임 워크 메시지로 응답합니다. 모든 8 개 경로는 GET 메소드이며, 나는 Fiddler와 내가 실제로 GET 동사를 사용하고 있음을 확인했습니다. 아직 작동중인 다른 REST 메서드와 다른 점을 볼 수 없습니다.

성공적으로 올바른 JSON 반환 위치 아이디 = 2

GET http://localhost:57004/AppsService.svc/v1/locations/2 

를 얻을 수

테스트 URL : 여기

{ 
    "Id": 2, 
    "Identifier": "L85", 
    "Name": "The Huge Lake", 
    "Signals": null 
} 

그 위치 ID에서 모든 "방문"객체를 얻기 위해 시도에서 테스트 URL입니다 = 2

GET http://localhost:57004/AppsService.svc/v1/locations/2/visits 

해당 URL은 404 프레임 워크 예외로 인해 실패합니다 :

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Runtime.Serialization; 
using System.ServiceModel; 
using System.ServiceModel.Web; 
using System.Text; 
using WebAppsService.Models; 

namespace WebAppsService 
{ 
    [ServiceContract] 
    public interface IAppsService 
    { 
     [OperationContract] 
     [WebGet(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, 
      UriTemplate = "v1/version")] 
     string GetVersion(); 

     [OperationContract] 
     [WebGet(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, 
      UriTemplate = "v1/locations/{id}")] 
     Location GetLocation(string id); 

     // DCSR-specific Location APIs 
     [OperationContract] 
     [WebGet(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, 
      UriTemplate = "v1/locations/{id}/signals")] 
     List<Signal> GetLocationSignals(string id); 

     [OperationContract] 
     [WebGet(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, 
      UriTemplate = "v1/locations&q={searchText}")] 
     List<Location> GetLocations(string searchText); 

     [OperationContract] 
     [WebGet(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, 
      UriTemplate = "v1/locations/signals/{signalIds}")] 
     List<Location> GetLocationsContainingSignals(string signalIds); 

     [OperationContract] 
     [WebGet(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, 
      UriTemplate = "v1/locations/{id}/visits")] 
     List<Visit> GetVisits(string id); 

     [OperationContract] 
     [WebGet(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, 
      UriTemplate = "v1/locations/{locationId}/visits/{id}")] 
     Visit GetVisit(string locationId, string id); 

     [OperationContract] 
     [WebGet(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, 
      UriTemplate = "v1/signals/{id}")] 
     Signal GetSignal(string id); 
    } 
} 

어떤 아이디어 : 여기

<HTML> 
    <HEAD> 
     <STYLE type="text/css">#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}</STYLE> 
     <TITLE>Service</TITLE> 
    </HEAD> 
    <BODY> 
     <DIV id="content"> 
      <P class="heading1">Service</P> 
      <BR/> 
      <P class="intro">Endpoint not found.</P> 
     </DIV> 
    </BODY> 
</HTML> 

전체 서비스 인터페이스 코드?

답변

0

발견 : 나를 발견했습니다.

끝점 # 6을 디버깅 한 후 프로젝트의 OutputPath 속성을 기본 "bin"에서 "$ (SolutionDir) \ $ Configuration"으로 변경했습니다.이 패턴은 모든 프로젝트에 사용됩니다.

VS에서 웹 프로젝트를 디버깅 할 때 IIS 또는 Cassini 독립 실행 형 웹 서버를 통해 프로젝트를 시작할 때 항상 어셈블리의 상대 "bin \"폴더를 찾습니다. 프로젝트의 OutputPath 속성은 불만없이 무시됩니다.

그래서 처음 6 개의 끝점에 대한 경로 만 포함 된 내 어셈블리의 오래된 버전을 디버깅했습니다. 쉬어