로컬로 실행되는 WCF 서비스와 원격으로 실행되는 클라이언트가 있습니다. 나는 단순히 Thread.CurrentPrincipal.Identity.Name, ServiceSecurityContext.Current.WindowsIdentity.Name 및 OperationContext.Current.ServiceSecurityContext.WindowsIdentity를 반환 더미 방법의 설정을 가지고WCF 전송 Windows 인증 (NET.TCP 포함)은 로컬에서만 작동합니다.
<binding name="TcpBindingConfiguration_2">
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
<message clientCredentialType="Windows"/>
</security>
</binding>
: 나는에 양쪽에 바인딩을 일치했다. 가능한 경우 이름.
서버와 동일한 시스템에서 클라이언트를 실행하는 경우 전송 모드가 올바르게 작동하고 세 가지 ID 이름을 모두 사용할 수 있습니다. 그러나 원격 호스트 (동일 도메인과 다른 도메인의 호스트에서 테스트)에서 로컬 컴퓨터에 연결할 때 "서버에서 클라이언트 자격 증명을 거부했습니다."라는 메시지가 나타납니다.
나는 결합을 변경하는 경우 : 연결이 이루어
<binding name="TcpBindingConfiguration_1">
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="None"/>
</binding>
하고 (내가 상상하는 것 같은) 더미 방법은 이름을 전혀 반환하지 않습니다.
net.tcp 바인딩을 사용하여 다른 호스트 (때로는 다른 신뢰할 수있는 도메인)에서 Windows 인증을 사용하도록 구성을 공유 할 수 있습니까? 나는 보안 모드를 None으로 설정하는 예를 많이 보았지만 이는 모두 훌륭하고 훌륭하지만 여전히 누가 전화를 걸 었는지 식별하려고합니다.
그럼 다음은 무엇입니까? 모드 가져 오기 = "전송"이 작동합니까? 모드 = "없음"을 사용하고 다른 유형의 승인을 구현합니까? Windows 인증을 사용하는 다른 바인딩으로 변경 하시겠습니까?
다른 곳에서 답변을 보내면 사과드립니다. 나는 분명히 어딘가에 답을 찾을 수 없다.
업데이트 : 이것은 내가 지금 내 클라이언트를 만드는 데 사용하고 코드는 다음과 같습니다
var endPointAddress = "net.tcp://" + remoteHost + ":8092/Marc/WcfService";
EndpointAddress address = new EndpointAddress(new Uri(endPointAddress), EndpointIdentity.CreateSpnIdentity("AppName/" + remoteHost), new AddressHeaderCollection());
NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;
using (var remoteService = new RemoteService.GuestServiceClient(binding, address))
{
try
{
MessageBox.Show(remoteService.Hello("Marc"));
remoteService.Close();
}
catch (Exception ex)
{
remoteService.Abort();
MessageBox.Show("Error occurred:\n\n" + ex.Source + "\n\n" + ex.Message, "Could not connect to " + remoteHost, MessageBoxButton.OK, MessageBoxImage.Error);
}
}
REMOTEHOST은 원격 컴퓨터의 IP 주소로 설정되고있다.
채널과 프록시를 사용해야합니까? 나는 다른 곳에서 다른 코드를 보았습니다 만,이 단순한 인스턴스화 된 GuestServiceClient()가 (적어도 로컬에서는) 작동하는 것처럼 보입니다.
나는 클라이언트를 만드는 데 코드를 사용하지만 서버를 만들려면 config를 사용하고 있습니다. 왜 나 한테 물어 보지 마라, 그냥 그런 식으로 일어난 .. LOL .. 아직도 기쁨을 얻지 못한다. 내가 클라이언트에서 사용하고있는 코드이다. 위와 같이 채널이나 프록시를 사용합니까? 아니면 클라이언트를 여십니까? – Marc
나는 다른 프로젝트를 위해 한 코드를 파헤쳐 내가 놓친 것만 보았습니다. –