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의입니다.
어떤 소프트웨어 버전을 사용하고 있습니까? –
네비게이션 할 URI는 무엇입니까? 샘플을 주실 수 있습니까? –
서버의 URI를 같은 것들입니다 HTTP : //localhost/MemberServices/MemberServices.svc/Bob HTTP : //localhost/MemberServices/MemberServices.svc/1234/Favorites/567 나는 모든 서비스 팩 VS 2005를 실행하고 , IIS 5.1, .NET 3.5 –