Beispiel #1
0
        private void InitializeForMarshal(WhereaboutsReader whereabouts)
        {
            ProtocolInformationReader protocolInformation = whereabouts.ProtocolInformation;

            if ((protocolInformation != null) && protocolInformation.NetworkOutboundAccess)
            {
                if (protocolInformation.IsV10Enabled)
                {
                    UriBuilder builder = new UriBuilder(Uri.UriSchemeHttps, protocolInformation.HostName, protocolInformation.HttpsPort, protocolInformation.BasePath + "/" + BindingStrings.RegistrationCoordinatorSuffix(ProtocolVersion.Version10));
                    this.registrationServiceAddress10 = builder.Uri;
                }
                if (protocolInformation.IsV11Enabled)
                {
                    UriBuilder builder2 = new UriBuilder(Uri.UriSchemeHttps, protocolInformation.HostName, protocolInformation.HttpsPort, protocolInformation.BasePath + "/" + BindingStrings.RegistrationCoordinatorSuffix(ProtocolVersion.Version11));
                    this.registrationServiceAddress11 = builder2.Uri;
                }
                this.issuedTokensEnabled = protocolInformation.IssuedTokensEnabled;
                this.maxTimeout          = protocolInformation.MaxTimeout;
            }
            else
            {
                UriBuilder builder3 = new UriBuilder(Uri.UriSchemeHttps, whereabouts.HostName, 0x1bb, DisabledRegistrationPath);
                this.registrationServiceAddress10 = builder3.Uri;
                this.registrationServiceAddress11 = builder3.Uri;
                this.issuedTokensEnabled          = false;
                this.maxTimeout = TimeSpan.FromMinutes(5.0);
            }
        }
Beispiel #2
0
        public WsatConfiguration()
        {
            WhereaboutsReader         whereabouts         = this.GetWhereabouts();
            ProtocolInformationReader protocolInformation = whereabouts.ProtocolInformation;

            if (protocolInformation != null)
            {
                this.protocolService10Enabled = protocolInformation.IsV10Enabled;
                this.protocolService11Enabled = protocolInformation.IsV11Enabled;
            }
            this.Initialize(whereabouts);
            this.oleTxUpgradeEnabled = ReadFlag(@"Software\Microsoft\WSAT\3.0", "OleTxUpgradeEnabled", true);
        }
Beispiel #3
0
        private WhereaboutsReader GetWhereabouts()
        {
            WhereaboutsReader reader;

            try
            {
                reader = new WhereaboutsReader(TransactionInterop.GetWhereabouts());
            }
            catch (SerializationException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionManagerConfigurationException(System.ServiceModel.SR.GetString("WhereaboutsReadFailed"), exception));
            }
            return(reader);
        }
Beispiel #4
0
        void InitializeForMarshal(WhereaboutsReader whereabouts)
        {
            ProtocolInformationReader protocol = whereabouts.ProtocolInformation;

            if (protocol != null && protocol.NetworkOutboundAccess)
            {
                // We can marshal outgoing transactions using a valid address
                if (protocol.IsV10Enabled)
                {
                    UriBuilder builder10 = new UriBuilder(Uri.UriSchemeHttps,
                                                          protocol.HostName,
                                                          protocol.HttpsPort,
                                                          protocol.BasePath + "/" +
                                                          BindingStrings.RegistrationCoordinatorSuffix(ProtocolVersion.Version10));
                    this.registrationServiceAddress10 = builder10.Uri;
                }

                // when we have a WSAT1.1 coordinator
                if (protocol.IsV11Enabled)
                {
                    UriBuilder builder11 = new UriBuilder(Uri.UriSchemeHttps,
                                                          protocol.HostName,
                                                          protocol.HttpsPort,
                                                          protocol.BasePath + "/" +
                                                          BindingStrings.RegistrationCoordinatorSuffix(ProtocolVersion.Version11));

                    this.registrationServiceAddress11 = builder11.Uri;
                }

                this.issuedTokensEnabled = protocol.IssuedTokensEnabled;
                this.maxTimeout          = protocol.MaxTimeout;
            }
            else
            {
                // Generate an address that will not work
                // We do this in order to generate coordination contexts that can be propagated
                // between processes on the same node even if WS-AT is disabled
                UriBuilder builder = new UriBuilder(Uri.UriSchemeHttps,
                                                    whereabouts.HostName,
                                                    443,
                                                    DisabledRegistrationPath);

                this.registrationServiceAddress10 = builder.Uri;
                this.registrationServiceAddress11 = builder.Uri;
                this.issuedTokensEnabled          = false;
                this.maxTimeout = TimeSpan.FromMinutes(5);
            }
        }
Beispiel #5
0
 private void Initialize(WhereaboutsReader whereabouts)
 {
     try
     {
         this.InitializeForUnmarshal(whereabouts);
         this.InitializeForMarshal(whereabouts);
     }
     catch (UriFormatException exception)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionManagerConfigurationException(System.ServiceModel.SR.GetString("WsatUriCreationFailed"), exception));
     }
     catch (ArgumentOutOfRangeException exception2)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionManagerConfigurationException(System.ServiceModel.SR.GetString("WsatUriCreationFailed"), exception2));
     }
 }
Beispiel #6
0
        public WsatConfiguration()
        {
            // Get whereabouts
            WhereaboutsReader whereabouts = GetWhereabouts();

            ProtocolInformationReader protocol = whereabouts.ProtocolInformation;

            if (protocol != null)
            {
                this.protocolService10Enabled = protocol.IsV10Enabled;
                this.protocolService11Enabled = protocol.IsV11Enabled;
            }

            Initialize(whereabouts);

            // Read local registry flag
            this.oleTxUpgradeEnabled = ReadFlag(WsatKey, OleTxUpgradeEnabledValue, OleTxUpgradeEnabledDefault);
        }
Beispiel #7
0
        private void InitializeForUnmarshal(WhereaboutsReader whereabouts)
        {
            ProtocolInformationReader protocolInformation = whereabouts.ProtocolInformation;

            if ((protocolInformation != null) && protocolInformation.NetworkInboundAccess)
            {
                string str;
                this.inboundEnabled = true;
                bool   flag   = string.Compare(Environment.MachineName, protocolInformation.NodeName, StringComparison.OrdinalIgnoreCase) == 0;
                string suffix = BindingStrings.ActivationCoordinatorSuffix(ProtocolVersion.Version10);
                string str3   = BindingStrings.ActivationCoordinatorSuffix(ProtocolVersion.Version11);
                if (protocolInformation.IsClustered || (protocolInformation.NetworkClientAccess && !flag))
                {
                    if (protocolInformation.IsClustered)
                    {
                        str = null;
                    }
                    else
                    {
                        str = "host/" + protocolInformation.HostName;
                    }
                    if (protocolInformation.IsV10Enabled)
                    {
                        this.remoteActivationService10 = this.CreateActivationEndpointAddress(protocolInformation, suffix, str, true);
                    }
                    if (protocolInformation.IsV11Enabled)
                    {
                        this.remoteActivationService11 = this.CreateActivationEndpointAddress(protocolInformation, str3, str, true);
                    }
                }
                if (flag)
                {
                    str = "host/" + protocolInformation.NodeName;
                    if (protocolInformation.IsV10Enabled)
                    {
                        this.localActivationService10 = this.CreateActivationEndpointAddress(protocolInformation, suffix, str, false);
                    }
                    if (protocolInformation.IsV11Enabled)
                    {
                        this.localActivationService11 = this.CreateActivationEndpointAddress(protocolInformation, str3, str, false);
                    }
                }
            }
        }
Beispiel #8
0
 void Initialize(WhereaboutsReader whereabouts)
 {
     // MB 47153: don't throw system exception if whereabouts data is broken
     try
     {
         InitializeForUnmarshal(whereabouts);
         InitializeForMarshal(whereabouts);
     }
     catch (UriFormatException e)
     {
         // UriBuilder.Uri can throw this if the URI is ultimately invalid
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                   new TransactionManagerConfigurationException(SR.GetString(SR.WsatUriCreationFailed), e));
     }
     catch (ArgumentOutOfRangeException e)
     {
         // UriBuilder constructor can throw this if port < 0
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                   new TransactionManagerConfigurationException(SR.GetString(SR.WsatUriCreationFailed), e));
     }
 }
 void Initialize(WhereaboutsReader whereabouts)
 {
     // MB 47153: don't throw system exception if whereabouts data is broken
     try
     {
         InitializeForUnmarshal(whereabouts);
         InitializeForMarshal(whereabouts);
     }
     catch (UriFormatException e)
     {
         // UriBuilder.Uri can throw this if the URI is ultimately invalid 
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
             new TransactionManagerConfigurationException(SR.GetString(SR.WsatUriCreationFailed), e));
     }
     catch (ArgumentOutOfRangeException e)
     {
         // UriBuilder constructor can throw this if port < 0
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
             new TransactionManagerConfigurationException(SR.GetString(SR.WsatUriCreationFailed), e));
     }
 }
        void InitializeForMarshal(WhereaboutsReader whereabouts)
        {
            ProtocolInformationReader protocol = whereabouts.ProtocolInformation;
            if (protocol != null && protocol.NetworkOutboundAccess)
            {
                // We can marshal outgoing transactions using a valid address
                if (protocol.IsV10Enabled)
                {
                    UriBuilder builder10 = new UriBuilder(Uri.UriSchemeHttps,
                                                          protocol.HostName,
                                                          protocol.HttpsPort,
                                                          protocol.BasePath + "/" +
                                                          BindingStrings.RegistrationCoordinatorSuffix(ProtocolVersion.Version10));
                    this.registrationServiceAddress10 = builder10.Uri;
                }

                // when we have a WSAT1.1 coordinator 
                if (protocol.IsV11Enabled)
                {
                    UriBuilder builder11 = new UriBuilder(Uri.UriSchemeHttps,
                                                          protocol.HostName,
                                                          protocol.HttpsPort,
                                                          protocol.BasePath + "/" +
                                                          BindingStrings.RegistrationCoordinatorSuffix(ProtocolVersion.Version11));

                    this.registrationServiceAddress11 = builder11.Uri;
                }

                this.issuedTokensEnabled = protocol.IssuedTokensEnabled;
                this.maxTimeout = protocol.MaxTimeout;
            }
            else
            {
                // Generate an address that will not work
                // We do this in order to generate coordination contexts that can be propagated 
                // between processes on the same node even if WS-AT is disabled
                UriBuilder builder = new UriBuilder(Uri.UriSchemeHttps,
                                                    whereabouts.HostName,
                                                    443,
                                                    DisabledRegistrationPath);

                this.registrationServiceAddress10 = builder.Uri;
                this.registrationServiceAddress11 = builder.Uri;
                this.issuedTokensEnabled = false;
                this.maxTimeout = TimeSpan.FromMinutes(5);
            }
        }
        void InitializeForUnmarshal(WhereaboutsReader whereabouts)
        {
            ProtocolInformationReader protocol = whereabouts.ProtocolInformation;
            if (protocol != null && protocol.NetworkInboundAccess)
            {
                this.inboundEnabled = true;

                bool isTmLocal = string.Compare(Environment.MachineName,
                                                protocol.NodeName,
                                                StringComparison.OrdinalIgnoreCase) == 0;

                string spnIdentity;

                string activationCoordinatorSuffix10 =
                    BindingStrings.ActivationCoordinatorSuffix(ProtocolVersion.Version10);

                string activationCoordinatorSuffix11 =
                    BindingStrings.ActivationCoordinatorSuffix(ProtocolVersion.Version11);

                if (protocol.IsClustered ||
                   (protocol.NetworkClientAccess && !isTmLocal))
                {
                    if (protocol.IsClustered)
                    {
                        // We cannot reliably perform mutual authentication against a clustered resource
                        // See MB 43523 for more details on this

                        spnIdentity = null;
                    }
                    else
                    {
                        spnIdentity = "host/" + protocol.HostName;
                    }

                    if (protocol.IsV10Enabled)
                    {
                        this.remoteActivationService10 = CreateActivationEndpointAddress(protocol,
                                                                                         activationCoordinatorSuffix10,
                                                                                         spnIdentity,
                                                                                         true);
                    }

                    if (protocol.IsV11Enabled)
                    {
                        this.remoteActivationService11 = CreateActivationEndpointAddress(protocol,
                                                                                         activationCoordinatorSuffix11,
                                                                                         spnIdentity,
                                                                                         true);
                    }
                }

                if (isTmLocal)
                {
                    spnIdentity = "host/" + protocol.NodeName;

                    // The net.pipe Activation endpoint uses the host name as a discriminant
                    // for cluster scenarios with more than one service on a node.
                    if (protocol.IsV10Enabled)
                    {
                        this.localActivationService10 = CreateActivationEndpointAddress(protocol,
                                                                                        activationCoordinatorSuffix10,
                                                                                        spnIdentity,
                                                                                        false);
                    }

                    if (protocol.IsV11Enabled)
                    {
                        this.localActivationService11 = CreateActivationEndpointAddress(protocol,
                                                                                        activationCoordinatorSuffix11,
                                                                                        spnIdentity,
                                                                                        false);
                    }
                }
            }
        }
Beispiel #12
0
        void InitializeForUnmarshal(WhereaboutsReader whereabouts)
        {
            ProtocolInformationReader protocol = whereabouts.ProtocolInformation;

            if (protocol != null && protocol.NetworkInboundAccess)
            {
                this.inboundEnabled = true;

                bool isTmLocal = string.Compare(Environment.MachineName,
                                                protocol.NodeName,
                                                StringComparison.OrdinalIgnoreCase) == 0;

                string spnIdentity;

                string activationCoordinatorSuffix10 =
                    BindingStrings.ActivationCoordinatorSuffix(ProtocolVersion.Version10);

                string activationCoordinatorSuffix11 =
                    BindingStrings.ActivationCoordinatorSuffix(ProtocolVersion.Version11);

                if (protocol.IsClustered ||
                    (protocol.NetworkClientAccess && !isTmLocal))
                {
                    if (protocol.IsClustered)
                    {
                        // We cannot reliably perform mutual authentication against a clustered resource
                        // See MB 43523 for more details on this

                        spnIdentity = null;
                    }
                    else
                    {
                        spnIdentity = "host/" + protocol.HostName;
                    }

                    if (protocol.IsV10Enabled)
                    {
                        this.remoteActivationService10 = CreateActivationEndpointAddress(protocol,
                                                                                         activationCoordinatorSuffix10,
                                                                                         spnIdentity,
                                                                                         true);
                    }

                    if (protocol.IsV11Enabled)
                    {
                        this.remoteActivationService11 = CreateActivationEndpointAddress(protocol,
                                                                                         activationCoordinatorSuffix11,
                                                                                         spnIdentity,
                                                                                         true);
                    }
                }

                if (isTmLocal)
                {
                    spnIdentity = "host/" + protocol.NodeName;

                    // The net.pipe Activation endpoint uses the host name as a discriminant
                    // for cluster scenarios with more than one service on a node.
                    if (protocol.IsV10Enabled)
                    {
                        this.localActivationService10 = CreateActivationEndpointAddress(protocol,
                                                                                        activationCoordinatorSuffix10,
                                                                                        spnIdentity,
                                                                                        false);
                    }

                    if (protocol.IsV11Enabled)
                    {
                        this.localActivationService11 = CreateActivationEndpointAddress(protocol,
                                                                                        activationCoordinatorSuffix11,
                                                                                        spnIdentity,
                                                                                        false);
                    }
                }
            }
        }