그래서 net.tcp 및 net.pipe에서 수신 대기하는 WCF 서비스가 있습니다. WCF 프록시 클라이언트를 생성했으며 TCP 또는 명명 된 파이프를 통해 연결할 수 있기를 바랍니다. app.config에서는 config가 필요 없지만 코드에서는 필요합니다.WCF 바인딩
WCF 클라이언트는 "net.tcp : // mymachine : 10001/MyService"또는 "net.pipe : // localhost/MyService"와 같이 런타임에 끝점 주소를 가져옵니다. Uri 구성표를 기반으로 올바른 NetTcpBinding 또는 NetNamedPipeBinding을 사용한다고 생각 하겠지만 그렇게 보이지는 않습니다.
그냥 명명 된 파이프 또는 TCP 바인딩을 사용하도록 프록시를 설정할 수 없으며 끝점 주소를 기반으로하는 프록시를 선택하겠습니까?
편집 : 좋아, 그래서 계획을 도청하고 바인딩 채울 :
var uri = new Uri("net.tcp://localhost:10001/MyService");
Binding b;
if (uri.Scheme == Uri.UriSchemeNetPipe) {
b = new NetNamedPipeBinding();
} else if (uri.Scheme == Uri.UriSchemeNetTcp) {
b = new NetTcpBinding();
} else if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps) {
b = new WSHttpBinding();
}
var proxy = new ClientProxy(b, new EndpointAddress(uri));
을하지만 연결 실패를 얻을 - 은 "통신 개체가, System.ServiceModel.Channels.ServiceChannel은 사용할 수 없습니다 통신이 Faulted 상태이기 때문에 통신 할 수 없습니다. "
BindingElement에 바인딩을 변경하고 NamedPipeTransportBindingElement, TcpTransportBindingElement 등을 CustomBinding과 함께 사용하면 차이점을 이해할 수 있는지 확실하지 않습니다.
[WCF 바인딩 및 채널 스택 이해] (http://wcfanswers.blogspot.com/2012/06/understanding-wcf-bindings-and-channel.html) 주제에 대한 간략한 설명. 어떤 시나리오에 어떤 바인딩을 사용해야하는지 이해하려면이 단계를 수행하십시오. –