문제

WCF 클라이언트 애플리케이션을 별도의 시스템에서 실행하는 호스트에 연결하는 문제는 이전에 요청한 질문에 문서화되어 있습니다.

WCF : 원격 엔드 포인트를 통과하는 이유는 왜 실패합니까?

그러나 여기에 제공된 솔루션에 따르면 빈 문자열과 함께 spnendpointidentity를 사용해야합니다. 내 코드는 내가 참조 한 예제에서 사례와 같은 것으로 보이지 않기 때문에 내가 만든 spnendpointidentity 객체로 무엇을 해야하는지 알아야합니다.

나는 endpointAddress를 통과하는 Channel Create Channel이라고 부르는 channelfactory가 있습니다.

    public override void InitialiseChannel()
    {
        SpnEndpointIdentity spnEndpointIdentity = new SpnEndpointIdentity("");
        var address = new EndpointAddress(EndpointName);

        Proxy = ChannelFactory.CreateChannel(address);
    }

(NB : channelfactory는 Ichannelfactory 유형입니다. 여기서 T는 서비스 계약 인터페이스입니다. CreateChannel에게 전달할 수 없습니다.

아니면 채널 공장을 만들 때 어떻게 든 사용할 수 있습니다.

    private ChannelFactory<T> CreateChannelFactory()
    {
        var binding = new NetTcpBinding
        {
            ReaderQuotas = { MaxArrayLength = 2147483647 },
            MaxReceivedMessageSize = 2147483647
        };

        SpnEndpointIdentity spnEndpointIdentity = new SpnEndpointIdentity(""); 
        var channelFactory = new ChannelFactory<T>(binding);

        return channelFactory;
    }

다시, 나는 그것을 생성자로 전달할 수 없으므로 어떻게해야합니까?

감사.

도움이 되었습니까?

해결책

당신은 그것을 얻었습니다.

누락 된 것은 endpointidentity를 endpointAddress와 연관시킨 다음 CreateChannel ()에 제공한다는 것입니다.

SpnEndpointIdentity spnEndpointIdentity = new SpnEndpointIdentity("");
var address = new EndpointAddress(EndpointName, spnEndpointIdentity);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top