MsdtcWrapper(string machineName, string virtualServerName, ConfigurationProvider configProvider) { if (configProvider == null) { throw new ArgumentNullException("configProvider"); } this.machineName = machineName; this.virtualServerName = virtualServerName; this.configProvider = configProvider; this.proxy = null; int hr; string hostName = GetTransactionManagerHostName(machineName, virtualServerName); if (IsLongHornClusterLocalDtc(machineName, virtualServerName)) { SafeNativeMethods.OLE_TM_CONFIG_PARAMS_V2 configParams = new SafeNativeMethods.OLE_TM_CONFIG_PARAMS_V2(); configParams.dwVersion = SafeNativeMethods.OLE_TM_CONFIG_VERSION_2; configParams.pwszClusterResourceName = "LOCAL"; hr = SafeNativeMethods.DtcGetTransactionManagerEx_WithConfigParams( hostName, string.Empty, ref IDtcNetworkAccessConfigInterfaceId, SafeNativeMethods.OLE_TM_FLAG_NONE, ref configParams, out proxy); } else { hr = SafeNativeMethods.DtcGetTransactionManagerEx( hostName, string.Empty, ref IDtcNetworkAccessConfigInterfaceId, SafeNativeMethods.OLE_TM_FLAG_NONE, IntPtr.Zero, out proxy); } if (proxy == null) { // Chances are we are on a XP machine; even on XP SP2 this interface is not available Utilities.Log("Unable to query IDtcNetworkAccessConfig" + hr); if (Utilities.IsLocalMachineName(machineName)) { controller = new System.ServiceProcess.ServiceController("MSDTC"); } else { // We do not use ServiceController to control remote services for secuirty concerns - use WMI remote process invocation to do that controller = null; } } }
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); }
void InitializeConfigurationProvider() { if (IsClustered) { this.msdtcConfigProvider = new ClusterRegistryConfigurationProvider(this.hClusterDtcResource, GetClusterMstdcRegistryKey()); this.wsatConfigProvider = new ClusterRegistryConfigurationProvider(this.hClusterDtcResource, WsatKeys.WsatClusterRegKey); } else { this.msdtcConfigProvider = new RegistryConfigurationProvider(RegistryHive.LocalMachine, WsatKeys.MsdtcRegKey, MachineName); this.wsatConfigProvider = new RegistryConfigurationProvider(RegistryHive.LocalMachine, WsatKeys.WsatRegKey, MachineName); } }