NamedPipe 샘플은 동일한 컴퓨터에서 netNamedPipeBinding 프로세스 간 통신을 제공하는 바인딩을 보여 줍니다. 명명된 파이프는 서로 다른 컴퓨터 간에 작동하지 않습니다. 이 샘플은 시작 계산기 서비스를 기반으로 합니다.
이 샘플에서는 서비스가 자체 호스팅됩니다. 클라이언트와 서비스는 모두 콘솔 애플리케이션입니다.
비고
이 샘플에 대한 설치 절차 및 빌드 지침은 이 항목의 끝에 있습니다.
바인딩은 클라이언트 및 서비스에 대한 구성 파일에 지정됩니다. 바인딩 형식은 다음 샘플 구성에 표시된 대로 binding 또는 > 요소의 에 지정됩니다.
<endpoint address="net.pipe://localhost/ServiceModelSamples/service"
binding="netNamedPipeBinding"
contract="Microsoft.ServiceModel.Samples.ICalculator" />
이전 샘플에서는 기본 설정과 함께 바인딩을 사용하도록 엔드포인트를 netNamedPipeBinding 구성하는 방법을 보여 있습니다. 바인딩을 netNamedPipeBinding 구성하고 일부 설정을 변경하려면 바인딩 구성을 정의해야 합니다. 엔드포인트는 bindingConfiguration 특성으로 이름을 사용하여 바인딩 구성을 참조해야 합니다.
<endpoint address="net.pipe://localhost/ServiceModelSamples/service"
binding="netNamedPipeBinding"
bindingConfiguration="Binding1"
contract="Microsoft.ServiceModel.Samples.ICalculator" />
이 샘플에서 바인딩 구성의 이름은 Binding1 다음과 같습니다.
<bindings>
<!--
Following is the expanded configuration section for a NetNamedPipeBinding.
Each property is configured with the default value.
-->
<netNamedPipeBinding>
<binding name="Binding1"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00"
transactionFlow="false"
transferMode="Buffered"
transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288"
maxBufferSize="65536"
maxConnections="10"
maxReceivedMessageSize="65536">
<security mode="Transport">
<transport protectionLevel="EncryptAndSign" />
</security>
</binding>
</netNamedPipeBinding>
</bindings>
샘플을 실행하면 작업 요청 및 응답이 클라이언트 콘솔 창에 표시됩니다. 클라이언트 창에서 Enter 키를 눌러 클라이언트를 종료합니다.
Add(100,15.99) = 115.99
Subtract(145,76.54) = 68.46
Multiply(9,81.25) = 731.25
Divide(22,7) = 3.14285714285714
Press <ENTER> to terminate client.
샘플을 설정, 빌드 및 실행하려면
Windows Communication Foundation 샘플 에 대한One-Time 설정 절차를 수행했는지 확인합니다.
솔루션의 C# 또는 Visual Basic .NET 버전을 빌드하려면 Windows Communication Foundation 샘플빌드의 지침을 따릅니다.
단일 컴퓨터 구성에서 샘플을 실행하려면 Windows Communication Foundation 샘플 실행의 지침을 따릅니다.