WCF REST 서비스가 작동하지 않는 것 같습니다 - 구성 문제가 있습니까?
다음과 같은 서비스 계약을 통해 IIS (개발 중 IIS 익스프레스)에서 호스팅되는 사용자 지정 Y 인딩 WCF 서비스가 있습니다.[ServiceContract]
public interface IServer
{
[OperationContract]
StreamCollection GetStreams(Guid poolKey);
[OperationContract]
PoolCollection GetPools();
[OperationContract]
StreamEntity GetStream(Guid poolKey, string localIndex);
}
클라이언트에서 잘 작동하며 WCFTestClient에서 메타 데이터가 확인되었습니다.
그 기능을 REST로 노출시켜야하므로 아래와 같이 새로운 계약을 만들었습니다.
동일한 서비스 클래스에서 두 인터페이스를 모두 구현했습니다.
<behaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="CustomBinding">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="655360" />
</binding>
</customBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" name="MyServ.Server.Server">
<endpoint address="" binding="customBinding" bindingConfiguration="CustomBinding" contract="MyServ.Server.IServer" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="rest" behaviorConfiguration="webHttp" binding="webHttpBinding" contract="MyServ.Server.IRestServer" />
</service>
</services>
하지만, 나머지를 사용하여 서비스에 액세스 할 때
http://localhost:<myport>/Service.svc/pools
http://localhost:<myport>/Service.svc/pool/somekey/streams
http://localhost:<myport>/Service.svc/pool/somekey/streams
와 같은 URL을 사용하면 오류 404가 발생합니다.
일부 메서드와 IIS 프로세스에 연결된 디버거를 가리 키지 만 아무 것도 호출되지 않는 것 같습니다.
WCFTestClient를 사용하여 서비스 메타 데이터를 확인하면 IRestService가 아닌 IService 만 보입니다. 이게 정상인가? EDIT : 네, 보이는 것입니다 (check this)
어떤 제안 주셔서 감사합니다.
난 당신 같은 서비스는 모두 인터페이스를 구현 있으리라 믿고있어 ... 하나 Responsibility는 원칙을 준수, 처음부터이 방법을 사용 하는가? –
예. 이 접근 방식에 문제가있을 수 있습니까? – bzamfir
둘 다 구현되지 않았다면 문제가있을 것이라고 제안하려고했습니다. :) –