2009-06-08 4 views
0

저는 현재 VS 2005을 사용하여 C#에서 RESTful WCF 서비스를 작성하고 있습니다. IIS를 통해 서비스를 호스팅하고 .svc를 탐색 할 수 있지만 내가 얻을 수있는 URI 중 하나를 탐색하려고 할 때마다 404 오류. wcftestclient (VS 2008에 포함됨)를 실행하면 메소드를 볼 수 있으므로 서비스가 작동 중임을 알 수 있습니다. 문제는 구현의 REST 부분에있는 것으로 보입니다. 어떤 도움을 크게 감상 할 수IIS에서 RESTful WCF 호스팅

[ServiceContract()] 
    interface IExternalAPI { 
    [OperationContract] 
    [WebGet (BodyStyle=WebMessageBodyStyle.Bare,ResponseFormat=WebMessageFormat.Json,UriTemplate="{APIKey}/Favorites/{userId}")] 
    string GetFavoritesList(string APIKey, string userId); 

    [OperationContract] 
    [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "{APIKey}/Addresses/{userId}")] 
    string GetAddressList(string APIKey, string userId); 

    [OperationContract] 
    [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "{APIKey}/Authenticate/{userName}/{password}")] 
    string Authenticate(string APIKey, string username, string password); 

    [OperationContract] 
    [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "{APIKey}/Checkout/{orderId}/{userId}/{tip}/{addressId}")] 
    string Checkout(string APIKey, string orderId, string userId, string tip, string addressId); 

    [OperationContract] 
    [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "{APIKey}/AddToOrder/{templateId}/{userId}")] 
    string AddFavoriteToOrder(string APIKey, string templateId, string userId); 

    [OperationContract] 
    [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "{APIKey}/Pending/{userId}")] 
    string GetPendingOrders(string APIKey, string userId); 

    [OperationContract] 
    [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "Bob")] 
    string TestMethod(); 
    } 

:

<system.serviceModel> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> 
    <services> 
     <service behaviorConfiguration="ServiceBehavior" name="MyAPI"> 
     <endpoint binding="webHttpBinding" contract="IExternalAPI"/> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="ServiceBehavior"> 
      <webHttp/> 
     </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
     <behavior name="ServiceBehavior"> 
      <serviceMetadata httpGetEnabled="true"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

이 계약이다

내 Web.config의입니다.

+0

어떤 소프트웨어 버전을 사용하고 있습니까? –

+0

네비게이션 할 URI는 무엇입니까? 샘플을 주실 수 있습니까? –

+0

서버의 URI를 같은 것들입니다 HTTP : //localhost/MemberServices/MemberServices.svc/Bob HTTP : //localhost/MemberServices/MemberServices.svc/1234/Favorites/567 나는 모든 서비스 팩 VS 2005를 실행하고 , IIS 5.1, .NET 3.5 –

답변

2

나는이 게시물이 게시 된 지 4 개월 후이지만 비슷한 상황에 처해 있음을 알고 있습니다. 내 구성은 귀하의 것과 거의 동일하게 보이며 endpointBehavior 키를 추가 할 때까지 동일한 문제가 발생했습니다. 서비스 엔드 포인트에서 엔드 포인트 작동에 대한 명시 적 참조를 지정하십시오. 도움이 될지도 몰라.

<service behaviorConfiguration="ServiceBehavior" name="MyAPI"> 
    <endpoint binding="webHttpBinding" behaviorConfiguration="ServiceBehavior" contract="IExternalAPI"/> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
</service> 
관련 문제