Esempio n. 1
0
        void SaveRemote(string machineName, bool restart, bool clusterRemoteNode)
        {
            string portString           = null;
            string endpointCertString   = null;
            string accountsString       = null;
            string accountsCertsString  = null;
            string defaultTimeoutString = null;
            string maxTimeoutString     = null;
            string traceLevelString     = null;
            string traceActivityString  = null;
            string tracePropString      = null;
            string tracePiiString       = null;

            // Performance is not a concern here so we just do plain string concatenation
            string networkEnabledString = " -" + CommandLineOption.Network + ":" +
                                          (this.TransactionBridgeEnabled ? CommandLineOption.Enable : CommandLineOption.Disable);
            string virtualServerString = null;

            if (!string.IsNullOrEmpty(VirtualServer))
            {
                virtualServerString = " -" + CommandLineOption.ClusterVirtualServer + ":" + "\"" + VirtualServer + "\"";
            }

            if (this.TransactionBridgeEnabled)
            {
                portString           = " -" + CommandLineOption.Port + ":" + this.HttpsPort;
                endpointCertString   = this.X509Certificate == null ? "" : " -" + CommandLineOption.EndpointCert + ":" + this.X509Certificate.Thumbprint;
                accountsString       = " -" + CommandLineOption.Accounts + ":" + BuildAccountsArgument();
                accountsCertsString  = " -" + CommandLineOption.AccountsCerts + ":" + BuildAccountsCertsArgument();
                defaultTimeoutString = " -" + CommandLineOption.DefaultTimeout + ":" + this.DefaultTimeout.ToString(CultureInfo.InvariantCulture);
                traceLevelString     = " -" + CommandLineOption.TraceLevel + ":" + ((uint)this.TraceLevel).ToString(CultureInfo.InvariantCulture);
                traceActivityString  = " -" + CommandLineOption.TraceActivity + ":" + (this.ActivityTracing ? CommandLineOption.Enable : CommandLineOption.Disable);
                tracePropString      = " -" + CommandLineOption.TraceProp + ":" + (this.ActivityPropagation ? CommandLineOption.Enable : CommandLineOption.Disable);
                tracePiiString       = " -" + CommandLineOption.TracePii + ":" + (this.TracePii ? CommandLineOption.Enable : CommandLineOption.Disable);
                maxTimeoutString     = " -" + CommandLineOption.MaxTimeout + ":" + this.MaxTimeout.ToString(CultureInfo.InvariantCulture);
            }

            string arguments = networkEnabledString + virtualServerString + portString + endpointCertString + accountsString +
                               accountsCertsString + defaultTimeoutString + maxTimeoutString +
                               traceLevelString + traceActivityString + tracePropString + tracePiiString;

            if (clusterRemoteNode)
            {
                arguments += " -" + CommandLineOption.ClusterRemoteNode + ":" + CommandLineOption.Enable;
            }

            if (restart)
            {
                arguments += " -" + CommandLineOption.Restart;
            }

            Utilities.Log("Remote command arguments: " + arguments);

            RemoteHelper remote = new RemoteHelper(machineName);

            remote.ExecuteWsatProcess(arguments);
        }
        void SaveRemote(string machineName, bool restart, bool clusterRemoteNode)
        {
            string portString = null;
            string endpointCertString = null;
            string accountsString = null;
            string accountsCertsString = null;
            string defaultTimeoutString = null;
            string maxTimeoutString = null;
            string traceLevelString = null;
            string traceActivityString = null;
            string tracePropString = null;
            string tracePiiString = null;

            // Performance is not a concern here so we just do plain string concatenation
            string networkEnabledString = " -" + CommandLineOption.Network + ":" +
                            (this.TransactionBridgeEnabled ? CommandLineOption.Enable : CommandLineOption.Disable);
            string virtualServerString = null;
            if (!string.IsNullOrEmpty(VirtualServer))
            {
                virtualServerString = " -" + CommandLineOption.ClusterVirtualServer + ":" + "\"" + VirtualServer + "\"";
            }
            
            if (this.TransactionBridgeEnabled)
            {
                portString = " -" + CommandLineOption.Port + ":" + this.HttpsPort;
                endpointCertString = this.X509Certificate == null ? "" : " -" + CommandLineOption.EndpointCert + ":" + this.X509Certificate.Thumbprint;
                accountsString = " -" + CommandLineOption.Accounts + ":" + BuildAccountsArgument();
                accountsCertsString = " -" + CommandLineOption.AccountsCerts + ":" + BuildAccountsCertsArgument();
                defaultTimeoutString = " -" + CommandLineOption.DefaultTimeout + ":" + this.DefaultTimeout.ToString(CultureInfo.InvariantCulture);
                traceLevelString = " -" + CommandLineOption.TraceLevel + ":" + ((uint)this.TraceLevel).ToString(CultureInfo.InvariantCulture);
                traceActivityString = " -" + CommandLineOption.TraceActivity + ":" + (this.ActivityTracing ? CommandLineOption.Enable : CommandLineOption.Disable);
                tracePropString = " -" + CommandLineOption.TraceProp + ":" + (this.ActivityPropagation ? CommandLineOption.Enable : CommandLineOption.Disable);
                tracePiiString = " -" + CommandLineOption.TracePii + ":" + (this.TracePii ? CommandLineOption.Enable : CommandLineOption.Disable);
                maxTimeoutString = " -" + CommandLineOption.MaxTimeout + ":" + this.MaxTimeout.ToString(CultureInfo.InvariantCulture);
            }

            string arguments = networkEnabledString + virtualServerString + portString + endpointCertString + accountsString +
                                accountsCertsString + defaultTimeoutString + maxTimeoutString +
                                traceLevelString + traceActivityString + tracePropString + tracePiiString;

            if (clusterRemoteNode)
            {
                arguments += " -" + CommandLineOption.ClusterRemoteNode + ":" + CommandLineOption.Enable;
            }

            if (restart)
            {
                arguments += " -" + CommandLineOption.Restart;
            }

            Utilities.Log("Remote command arguments: " + arguments);
            
            RemoteHelper remote = new RemoteHelper(machineName);
            remote.ExecuteWsatProcess(arguments);
        }