Пример #1
0
        private static EndpointAddress getEndPoint(PropertyString connectionProperties, bool isWindowsCredential)
        {
            EndpointAddress endPointAddress;
            Uri             uri = new Uri(connectionProperties.GetString("Uri", true));

            if (isWindowsCredential)
            {
                string upnIdentity = connectionProperties.GetString("UPNIdentity", false);
                if (!String.IsNullOrEmpty(upnIdentity))
                {
                    endPointAddress = new EndpointAddress(uri, EndpointIdentity.CreateUpnIdentity(upnIdentity));
                }
                else
                {
                    string spnIdentity = connectionProperties.GetString("SPNIdentity", false);
                    if (!String.IsNullOrEmpty(spnIdentity))
                    {
                        endPointAddress = new EndpointAddress(uri, EndpointIdentity.CreateSpnIdentity(upnIdentity));
                    }
                    else
                    {
                        endPointAddress = new EndpointAddress(uri);
                    }
                }
            }
            else
            {
                endPointAddress = new EndpointAddress(uri);
            }
            return(endPointAddress);
        }