0
데비안의 Mono에서 작동하는 WCF 서비스가 있습니다.
내 목표는 서비스중인 클라이언트 IP 주소를 얻는 것입니다.
나는 RemoteEndpointMessageProperty
를 사용하는 주요 솔루션입니다 것을 보여 유사한 주제의 큰 용량을 읽습니다 : 위의 그림과 같이 Linux의 WCF 서비스에서 클라이언트 IP를 얻는 방법은 무엇입니까?
OperationContext oOperationContext = OperationContext.Current;
MessageProperties oMessageProperties = oOperationContext.IncomingMessageProperties;
var prop = oMessageProperties[RemoteEndpointMessageProperty.Name];
RemoteEndpointMessageProperty oRemoteEndpointMessageProperty = prop as RemoteEndpointMessageProperty;
string szAddress = oRemoteEndpointMessageProperty.Address;
int nPort = oRemoteEndpointMessageProperty.Port;
내가 동일했다.
그러나 문제는
oMessageProperties
에는
RemoteEndpointMessageProperty.Name
키가 포함되어 있지 않으며 값이
System.ServiceModel.Channels.BinaryMessageEncoder
인 "인코더"만 있습니다.
왜 이런 일이 발생하며이를 해결하는 방법을 아는 사람이 있습니까? 내가
'HttpContext.Current' 내 서비스 null''이다. 'ASP.NET Compatibility Mode'를 추가했으나 도움이되지 않았습니다. – skelter