예제 #1
0
        internal static MsdtcWrapper GetWrapper(string machineName, string virtualServerName, ConfigurationProvider configProvider)
        {
            MsdtcWrapper wrapper;

            string key = GetTransactionManagerHostName(machineName, virtualServerName);
            wrappers.TryGetValue(key, out wrapper);
            if (wrapper == null)
            {
                wrapper = new MsdtcWrapper(machineName, virtualServerName, configProvider);
                wrappers.Add(key, wrapper);
            }
            return wrapper;
        }
        internal static MsdtcWrapper GetWrapper(string machineName, string virtualServerName, ConfigurationProvider configProvider)
        {
            MsdtcWrapper wrapper;

            string key = GetTransactionManagerHostName(machineName, virtualServerName);

            wrappers.TryGetValue(key, out wrapper);
            if (wrapper == null)
            {
                wrapper = new MsdtcWrapper(machineName, virtualServerName, configProvider);
                wrappers.Add(key, wrapper);
            }
            return(wrapper);
        }
예제 #3
0
파일: WSATControl.cs 프로젝트: mind0n/hive
        void InitializeConfig()
        {
            try
            {
                previousConfig = new WsatConfiguration(machineName, virtualServer, null, false);
                previousConfig.LoadFromRegistry();

                config = new WsatConfiguration(machineName, virtualServer, previousConfig, false);
                msdtc = config.GetMsdtcWrapper();
                ConfigurationToUI();
            }
            catch (WsatAdminException e)
            {
                HandleException(e);
            }
        }
예제 #4
0
        void InitializeConfig()
        {
            try
            {
                previousConfig = new WsatConfiguration(machineName, virtualServer, null, false);
                previousConfig.LoadFromRegistry();

                config = new WsatConfiguration(machineName, virtualServer, previousConfig, false);
                msdtc  = config.GetMsdtcWrapper();
                ConfigurationToUI();
            }
            catch (WsatAdminException e)
            {
                HandleException(e);
            }
        }
예제 #5
0
        internal void ValidateThrow()
        {
            if (this.TransactionBridgeEnabled)
            {
                // rule: WS-AT network support requires MSDTC network transaction to be enabled

                // GetNetworkTransactionAccess fails if current remote cluster node does not take ownership
                if (!IsClusterRemoteNode)
                {
                    MsdtcWrapper wrapper = this.GetMsdtcWrapper();
                    if (!wrapper.GetNetworkTransactionAccess())
                    {
                        throw new WsatAdminException(WsatAdminErrorCode.MSDTC_NETWORK_ACCESS_DISABLED,
                                                     SR.GetString(SR.ErrorMsdtcNetworkAccessDisabled));
                    }
                }

                // rule: HTTPS port must be in range 1-65535
                if (this.HttpsPort < 1)
                {
                    throw new WsatAdminException(WsatAdminErrorCode.INVALID_HTTPS_PORT,
                                                 SR.GetString(SR.ErrorHttpsPortRange));
                }

                // rule: local endpoint certificate must be specified and valid
                ValidateIdentityCertificateThrow(this.X509Certificate, !Utilities.IsLocalMachineName(MachineName));

                // rule: default timeout should be in range 1-3600
                if (this.DefaultTimeout < 1 || this.DefaultTimeout > 3600)
                {
                    throw new WsatAdminException(WsatAdminErrorCode.INVALID_DEFTIMEOUT_ARGUMENT,
                                                 SR.GetString(SR.ErrorDefaultTimeoutRange));
                }

                // rule: max timeout be in range 0-3600
                if (this.MaxTimeout > 3600)
                {
                    throw new WsatAdminException(WsatAdminErrorCode.INVALID_MAXTIMEOUT_ARGUMENT,
                                                 SR.GetString(SR.ErrorMaximumTimeoutRange));
                }
            }
        }
예제 #6
0
        void RestartHelper(bool restart)
        {
            if (restart)
            {
                try
                {
                    MsdtcWrapper msdtc = this.GetMsdtcWrapper();
                    msdtc.RestartDtcService();
                }
                catch (WsatAdminException)
                {
                    throw;
                }
#pragma warning suppress 56500
                catch (Exception e)
                {
                    if (Utilities.IsCriticalException(e))
                    {
                        throw;
                    }
                    throw new WsatAdminException(WsatAdminErrorCode.DTC_RESTART_ERROR, SR.GetString(SR.ErrorRestartMSDTC), e);
                }
            }
        }
예제 #7
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(SR.GetString(SR.ConfigNetworkSupport, Utilities.GetEnabledStatusString(this.TransactionBridgeEnabled || this.TransactionBridge30Enabled)));

            if (this.TransactionBridgeEnabled || this.TransactionBridge30Enabled)
            {
                sb.Append(SR.GetString(SR.ConfigHTTPSPort, this.HttpsPort));
                sb.Append(SR.GetString(SR.ConfigIdentityCertificate,
                                       this.X509Certificate == null ? SR.GetString(SR.ConfigNone) : this.X509Certificate.Thumbprint));
                sb.Append(SR.GetString(SR.ConfigKerberosGACL));
                if (this.KerberosGlobalAcl == null || this.KerberosGlobalAcl.Length < 1)
                {
                    sb.AppendLine(SR.GetString(SR.ConfigNone));
                }
                else
                {
                    int i = 0;
                    foreach (string ace in this.KerberosGlobalAcl)
                    {
                        if (i++ > 0)
                        {
                            sb.Append(SR.GetString(SR.ConfigACEPrefix));
                        }
                        sb.AppendLine(ace);
                    }
                }

                sb.Append(SR.GetString(SR.ConfigAcceptedCertificates));
                if (this.X509GlobalAcl == null || this.X509GlobalAcl.Length < 1)
                {
                    sb.AppendLine(SR.GetString(SR.ConfigNone));
                }
                else
                {
                    int i = 0;
                    foreach (string cert in this.X509GlobalAcl)
                    {
                        if (i++ > 0)
                        {
                            sb.Append(SR.GetString(SR.ConfigAcceptedCertPrefix));
                        }
                        sb.AppendLine(cert);
                    }
                }

                sb.Append(SR.GetString(SR.ConfigDefaultTimeout, this.DefaultTimeout));
                sb.Append(SR.GetString(SR.ConfigMaximumTimeout, this.MaxTimeout));

                SourceLevels level = this.TraceLevel;
                if (level != SourceLevels.All)
                {
                    level = level & ~SourceLevels.ActivityTracing;
                }
                sb.Append(SR.GetString(SR.ConfigTraceLevel, level));
                sb.Append(SR.GetString(SR.ConfigActivityTracing, Utilities.GetEnabledStatusString(this.ActivityTracing)));
                sb.Append(SR.GetString(SR.ConfigActivityProp, Utilities.GetEnabledStatusString(this.ActivityPropagation)));
                sb.Append(SR.GetString(SR.ConfigPiiTracing, Utilities.GetEnabledStatusString(this.TracePii)));

                MsdtcWrapper msdtc = this.GetMsdtcWrapper();
                if (!msdtc.GetNetworkTransactionAccess())
                {
                    sb.Append(Environment.NewLine);
                    sb.Append(SR.GetString(SR.ConfigWarningNetworkDTCAccessIsDisabled));
                }
            }
            else
            {
                // When network support is disabled, the only setting that still matters is the MaxTimeout
                sb.Append(SR.GetString(SR.ConfigMaximumTimeoutWhenNetworkDisabled, this.MaxTimeout));
            }

            return(sb.ToString());
        }
예제 #8
0
 internal MsdtcWrapper GetMsdtcWrapper()
 {
     return(MsdtcWrapper.GetWrapper(MachineName, VirtualServer, this.msdtcConfigProvider));
 }
예제 #9
0
        // Execute the user's command
        void Run()
        {
            switch (operation)
            {
            case Operations.Change:
                newConfig.ValidateThrow();
                if (restartRequired)
                {
                    Console.WriteLine(SR.GetString(SR.InfoRestartingMSDTC));
                }
                newConfig.Save(restartRequired);
                if (restartRequired)
                {
                    Console.WriteLine(SR.GetString(SR.InfoRestartedMSDTC));
                }
                if (newConfig.IsClustered)
                {
                    Console.WriteLine(SR.GetString(SR.ClusterConfigUpdatedSuccessfully));
                }
                else
                {
                    Console.WriteLine(SR.GetString(SR.ConfigUpdatedSuccessfully));
                }
                break;

            case Operations.None:
                // does nothing
                break;

            case Operations.Help:
            // fall through
            default:
                PrintUsage();
                break;
            }

            if (operation != Operations.Change && restartRequired)
            {
                try
                {
                    MsdtcWrapper msdtc = newConfig.GetMsdtcWrapper();
                    Console.WriteLine(SR.GetString(SR.InfoRestartingMSDTC));
                    msdtc.RestartDtcService();
                    Console.WriteLine(SR.GetString(SR.InfoRestartedMSDTC));
                }
                catch (WsatAdminException)
                {
                    throw;
                }
#pragma warning suppress 56500
                catch (Exception e)
                {
                    if (Utilities.IsCriticalException(e))
                    {
                        throw;
                    }
                    throw new WsatAdminException(WsatAdminErrorCode.DTC_RESTART_ERROR, SR.GetString(SR.ErrorRestartMSDTC), e);
                }
            }

            if (this.showRequired)
            {
                Console.WriteLine();
                Console.WriteLine(SR.GetString(SR.ConsoleShowInformation));
                Console.WriteLine(operation == Operations.Change ? this.newConfig.ToString() : this.previousConfig.ToString());
            }
        }