WCF NetNamedPipeBinding에 문제가 있습니다. Windows XP 시스템에서 Visual Studio 2008을 통해 서버 및 클라이언트 코드를 실행하면 모든 것이 잘 동작합니다. 그러나 서버를 Windows 서비스로 배포하고 Windows Server 2008에 클라이언트 응용 프로그램을 설치하자마자 계약 메서드를 사용하려고 할 때마다 클라이언트 끝에서 TimeoutException이 발생합니다. 그것은 성공적으로 클라이언트를 만들고 그것을 열 수 있지만 어떤 메서드를 호출 할 수없는 것 같습니다.WCF NetNamedPipeBinding TimeoutException (Windows Server 2008)
서비스 초기화 코드 :
Uri baseAddress = new Uri("http://localhost:8500/xNet/xNetService");
string address = "net.pipe://localhost/xNet/xNetService";
_xNetAPIServiceHost = new ServiceHost(typeof(xNetService), baseAddress);
NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
_xNetAPIServiceHost.AddServiceEndpoint(typeof(IServiceAPI), binding, address);
// Add a mex endpoint
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.HttpGetUrl = new Uri("http://localhost:8501/xNet/xNetService/mex");
_xNetAPIServiceHost.Description.Behaviors.Add(smb);
_xNetAPIServiceHost.Open();
클라이언트 초기화 코드 :
string address = "net.pipe://localhost/xNet/xNetService";
NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
_serviceClient = new ServiceAPIClient(binding, new EndpointAddress(address));
_serviceClient.Open();
Windows 서비스는 "로컬 시스템 계정"로 실행됩니다. 나는 문제가 무엇인지에 관해서는 손해보고있다. 보안 계정 문제인지 또는 명명 된 파이프가 열려 있는지 알 수 없습니다. 성공적으로 클라이언트 측을 만들고 열 수 있기 때문에 적어도 명명 된 파이프를 찾은 것으로 보입니다. 난 그냥 TimeoutException없이 서비스 메서드 중 하나를 호출 할 수 없습니다.
좋아, 내 앱이 어떤 바인딩 유형에서도 작동하지 않습니다. 대신 netTcpBinding을 테스트하기 위해 Add (int n1, int n2)라는 새로운 서비스가있는 새로운 프로젝트를 작성했습니다. installutil.exe를 사용하여 대상 2008 서버에 서비스를 수동으로 설치했고 클라이언트에서 서비스 참조 업데이트를 수행 한 다음 문제없이 프로그램을 실행했습니다. 같은 구성을 원래 서비스에 복사하려고했지만 작동하지 않으려 고했지만 ... * rips hair out *! – templar112