public static CoordinationContext GetCoordinationContext(Message message, ProtocolVersion protocolVersion) { int num; CoordinationContext context; CoordinationStrings strings = CoordinationStrings.Version(protocolVersion); string coordinationContext = strings.CoordinationContext; string ns = strings.Namespace; try { num = message.Headers.FindHeader(coordinationContext, ns); } catch (MessageHeaderException exception) { DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning); return(null); } if (num < 0) { return(null); } XmlDictionaryReader readerAtHeader = message.Headers.GetReaderAtHeader(num); using (readerAtHeader) { context = GetCoordinationContext(readerAtHeader, protocolVersion); } MessageHeaderInfo headerInfo = message.Headers[num]; if (!message.Headers.UnderstoodHeaders.Contains(headerInfo)) { message.Headers.UnderstoodHeaders.Add(headerInfo); } return(context); }
private TransactionContext CreateTransactionContext() { Microsoft.Transactions.Bridge.EnlistmentOptions enlistmentOptions = this.enlistment.EnlistmentOptions; string remoteTransactionId = this.enlistment.RemoteTransactionId; Guid localTransactionId = this.enlistment.LocalTransactionId; CoordinationContext context = new CoordinationContext(this.state.ProtocolVersion) { Expires = (enlistmentOptions.Expires == TimeSpan.MaxValue) ? uint.MaxValue : ((uint)((int)enlistmentOptions.Expires.TotalMilliseconds)), Identifier = remoteTransactionId, LocalTransactionId = localTransactionId, IsolationLevel = enlistmentOptions.IsoLevel, IsolationFlags = enlistmentOptions.IsolationFlags, Description = enlistmentOptions.Description }; string contextId = CoordinationContext.IsNativeIdentifier(remoteTransactionId, localTransactionId) ? null : remoteTransactionId; string sctId = null; RequestSecurityTokenResponse issuedToken = null; if (this.state.Config.PortConfiguration.SupportingTokensEnabled) { CoordinationServiceSecurity.CreateIssuedToken(localTransactionId, remoteTransactionId, this.state.ProtocolVersion, out issuedToken, out sctId); } AddressHeader refParam = new WsatRegistrationHeader(localTransactionId, contextId, sctId); context.RegistrationService = this.state.RegistrationCoordinatorListener.CreateEndpointReference(refParam); return(new TransactionContext(context, issuedToken)); }
//======================================================================================= // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version. /* * // We demand full trust because we use CoordinationServiceSecurity from a non-APTCA assembly and CoordinationServiceSecurity.GetIssuedToken(..) can call Environment.FailFast. * // It's recommended to not let partially trusted callers to bring down the process. * // WSATs are not supported in partial trust, so customers should not be broken by this demand. * [PermissionSet(SecurityAction.Demand, Unrestricted = true)] */ public override TransactionInfo ReadTransaction(Message message) { EnsureInitialized(); CoordinationContext context = WsatTransactionHeader.GetCoordinationContext(message, this.protocolVersion); if (context == null) { return(null); } // Incoming transaction tokens are optional RequestSecurityTokenResponse issuedToken; try { issuedToken = CoordinationServiceSecurity.GetIssuedToken(message, context.Identifier, this.protocolVersion); } catch (XmlException e) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new TransactionException(SR.FailedToDeserializeIssuedToken, e)); } return(new WsatTransactionInfo(this.wsatProxy, context, issuedToken)); }
public override void OnEvent(MsgEnlistTransactionEvent e) { CoordinatorEnlistment coordinator = e.Coordinator; if (!base.state.TransactionManager.Settings.NetworkInboundAccess) { base.ForwardEnlistmentEventToSubordinate(e); coordinator.StateMachine.ChangeState(base.state.States.CoordinatorInitializationFailed); } else { CoordinationContext currentContext = e.Body.CurrentContext; RegistrationProxy proxy = base.state.TryCreateRegistrationProxy(currentContext.RegistrationService); if (proxy == null) { coordinator.ContextManager.Fault = base.state.Faults.RegistrationProxyFailed; coordinator.StateMachine.ChangeState(base.state.States.CoordinatorInitializationFailed); } else { try { coordinator.SetRegistrationProxy(proxy); EnlistmentOptions options = coordinator.CreateEnlistmentOptions(currentContext.Expires, currentContext.ExpiresPresent, currentContext.IsolationLevel, currentContext.IsolationFlags, currentContext.Description); base.state.TransactionManagerSend.EnlistTransaction(coordinator, options, e); e.StateMachine.ChangeState(base.state.States.CoordinatorEnlisting); } finally { proxy.Release(); } } } }
private void ConfigureEnlistment(WsatRegistrationHeader header) { Enlistment enlistment = new Enlistment(); string contextId = header.ContextId; if (contextId == null) { contextId = CoordinationContext.CreateNativeIdentifier(header.TransactionId); } enlistment.LocalTransactionId = header.TransactionId; enlistment.RemoteTransactionId = contextId; Notifications twoPhaseCommit = Notifications.TwoPhaseCommit; switch (this.protocol) { case Microsoft.Transactions.Wsat.Messaging.ControlProtocol.Volatile2PC: twoPhaseCommit |= Notifications.Volatile | Notifications.Phase0; break; case Microsoft.Transactions.Wsat.Messaging.ControlProtocol.Durable2PC: break; default: Microsoft.Transactions.Bridge.DiagnosticUtility.FailFast("Invalid protocol"); break; } enlistment.NotificationMask = twoPhaseCommit; enlistment.ProtocolProviderContext = this; base.enlistment = enlistment; }
public RegistrationCoordinatorResponseInvalidMetadataSchema11(CoordinationContext context, ControlProtocol protocol, EndpointAddress coordinatorService) : base(context, protocol) { base.schemaId = "http://schemas.microsoft.com/2006/08/ServiceModel/RegistrationCoordinatorResponseInvalidMetadata11TraceRecord"; if (coordinatorService != null) { this.coordinatorService = EndpointAddress10.FromEndpointAddress(coordinatorService); } }
public WsatTransactionHeader(CoordinationContext context, ProtocolVersion protocolVersion) { this.context = context; CoordinationStrings strings = CoordinationStrings.Version(protocolVersion); this.wsatHeaderElement = strings.CoordinationContext; this.wsatNamespace = strings.Namespace; }
public WsatTransactionInfo(WsatProxy wsatProxy, CoordinationContext context, RequestSecurityTokenResponse issuedToken) { this.wsatProxy = wsatProxy; this.context = context; this.issuedToken = issuedToken; }
public RegisterCoordinatorRecordSchema10(CoordinationContext context, ControlProtocol protocol, EndpointAddress coordinatorService) : base(context, protocol) { base.schemaId = "http://schemas.microsoft.com/2006/08/ServiceModel/RegisterCoordinatorTraceRecord"; if (coordinatorService != null) { this.coordinatorService = EndpointAddressAugust2004.FromEndpointAddress(coordinatorService); } }
public CoordinatorEnlistment(ProtocolState state, TransactionContextManager contextManager, CoordinationContext context, RequestSecurityTokenResponse rstr) : base(state) { base.ourContextManager = contextManager; this.superiorContext = context; this.superiorRstr = rstr; this.ConfigureEnlistment(context); base.stateMachine = new CoordinatorStateMachine(this); base.stateMachine.ChangeState(state.States.CoordinatorInitializing); }
public static void Trace(Guid enlistmentId, CoordinationContext context) { CoordinationContextRecordSchema extendedData = new CoordinationContextRecordSchema(context); if (DiagnosticUtility.ShouldTraceInformation) { TxTraceUtility.Trace(TraceEventType.Information, 0xb000b, Microsoft.Transactions.SR.GetString("EnlistTransaction"), extendedData, null, enlistmentId, null); } }
public void MarshalAsCoordinationContext(Transaction transaction, out CoordinationContext context, out RequestSecurityTokenResponse issuedToken) { uint num; IsolationFlags flags; string str2; WsatExtendedInformation information; string str3; Guid distributedIdentifier = transaction.TransactionInformation.DistributedIdentifier; string contextId = null; context = new CoordinationContext(this.protocolVersion); OleTxTransactionFormatter.GetTransactionAttributes(transaction, out num, out flags, out str2); context.IsolationFlags = flags; context.Description = str2; if (TransactionCache <Transaction, WsatExtendedInformation> .Find(transaction, out information)) { context.Expires = information.Timeout; if (!string.IsNullOrEmpty(information.Identifier)) { context.Identifier = information.Identifier; contextId = information.Identifier; } } else { context.Expires = num; if (context.Expires == 0) { context.Expires = (uint)TimeoutHelper.ToMilliseconds(this.wsatConfig.MaxTimeout); } } if (context.Identifier == null) { context.Identifier = CoordinationContext.CreateNativeIdentifier(distributedIdentifier); contextId = null; } if (!this.wsatConfig.IssuedTokensEnabled) { str3 = null; issuedToken = null; } else { CoordinationServiceSecurity.CreateIssuedToken(distributedIdentifier, context.Identifier, this.protocolVersion, out issuedToken, out str3); } AddressHeader refParam = new WsatRegistrationHeader(distributedIdentifier, contextId, str3); context.RegistrationService = this.wsatConfig.CreateRegistrationService(refParam, this.protocolVersion); context.IsolationLevel = transaction.IsolationLevel; context.LocalTransactionId = distributedIdentifier; if (this.wsatConfig.OleTxUpgradeEnabled) { context.PropagationToken = TransactionInterop.GetTransmitterPropagationToken(transaction); } }
public static RegistrationCoordinatorResponseInvalidMetadataSchema Instance(CoordinationContext context, ControlProtocol protocol, EndpointAddress coordinatorService, ProtocolVersion protocolVersion) { ProtocolVersionHelper.AssertProtocolVersion(protocolVersion, typeof(RegistrationCoordinatorResponseInvalidMetadataSchema), "Instance"); switch (protocolVersion) { case ProtocolVersion.Version10: return(new RegistrationCoordinatorResponseInvalidMetadataSchema10(context, protocol, coordinatorService)); case ProtocolVersion.Version11: return(new RegistrationCoordinatorResponseInvalidMetadataSchema11(context, protocol, coordinatorService)); } return(null); }
public Transaction UnmarshalTransaction(WsatTransactionInfo info) { if (info.Context.ProtocolVersion != this.protocolVersion) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("InvalidWsatProtocolVersion"))); } if (this.wsatConfig.OleTxUpgradeEnabled) { byte[] propagationToken = info.Context.PropagationToken; if (propagationToken != null) { try { return(OleTxTransactionInfo.UnmarshalPropagationToken(propagationToken)); } catch (TransactionException exception) { DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning); } if (DiagnosticUtility.ShouldTraceInformation) { TraceUtility.TraceEvent(TraceEventType.Information, 0xe000e, System.ServiceModel.SR.GetString("TraceCodeTxFailedToNegotiateOleTx", new object[] { info.Context.Identifier })); } } } CoordinationContext context = info.Context; if (!this.wsatConfig.IsLocalRegistrationService(context.RegistrationService, this.protocolVersion)) { if (!this.wsatConfig.IsProtocolServiceEnabled(this.protocolVersion)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionException(System.ServiceModel.SR.GetString("WsatProtocolServiceDisabled", new object[] { this.protocolVersion }))); } if (!this.wsatConfig.InboundEnabled) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionException(System.ServiceModel.SR.GetString("InboundTransactionsDisabled"))); } if (this.wsatConfig.IsDisabledRegistrationService(context.RegistrationService)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionException(System.ServiceModel.SR.GetString("SourceTransactionsDisabled"))); } context = this.CreateCoordinationContext(info); } Guid localTransactionId = context.LocalTransactionId; if (localTransactionId == Guid.Empty) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionException(System.ServiceModel.SR.GetString("InvalidCoordinationContextTransactionId"))); } return(OleTxTransactionInfo.UnmarshalPropagationToken(MarshalPropagationToken(ref localTransactionId, context.IsolationLevel, context.IsolationFlags, context.Description))); }
public void OnRootTransactionCreated() { base.enlistmentId = base.enlistment.LocalTransactionId; base.enlistment.RemoteTransactionId = CoordinationContext.CreateNativeIdentifier(base.enlistmentId); EnlistmentHeader refParam = new EnlistmentHeader(base.enlistmentId); this.coordinatorService = base.state.CompletionCoordinatorListener.CreateEndpointReference(refParam); base.ourContextManager = new TransactionContextManager(base.state, base.enlistment.RemoteTransactionId); base.state.Lookup.AddTransactionContextManager(base.ourContextManager); base.ActivateTransactionContextManager(base.ourContextManager); base.AddToLookupTable(); base.VerifyAndTraceEnlistmentOptions(); base.TraceTransferEvent(); }
private void ConfigureEnlistment(CoordinationContext context) { Enlistment enlistment = new Enlistment(); string identifier = context.Identifier; if (identifier == null) { Microsoft.Transactions.Bridge.DiagnosticUtility.FailFast("Need transactionId to create enlistment"); } enlistment.RemoteTransactionId = identifier; enlistment.LocalTransactionId = Ports.GetGuidFromTransactionId(identifier); enlistment.ProtocolProviderContext = this; base.enlistment = enlistment; }
public static CoordinationContext GetCoordinationContext(XmlDictionaryReader reader, ProtocolVersion protocolVersion) { CoordinationContext context; CoordinationXmlDictionaryStrings strings = CoordinationXmlDictionaryStrings.Version(protocolVersion); try { context = CoordinationContext.ReadFrom(reader, strings.CoordinationContext, strings.Namespace, protocolVersion); } catch (InvalidCoordinationContextException exception) { DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Error); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionException(System.ServiceModel.SR.GetString("WsatHeaderCorrupt"), exception)); } return(context); }
// The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version. /* * // We demand full trust because we call into CoordinationXmlDictionaryStrings.Version(..), which is defined in a non-APTCA assembly and does an Environment.FailFast * // if the argument is invalid. It's recommended to not let partially trusted callers to bring down the process. * // WSATs are not supported in partial trust, so customers should not be broken by this demand. * [PermissionSet(SecurityAction.Demand, Unrestricted = true)] */ public static CoordinationContext GetCoordinationContext(XmlDictionaryReader reader, ProtocolVersion protocolVersion) { CoordinationXmlDictionaryStrings coordinationXmlDictionaryStrings = CoordinationXmlDictionaryStrings.Version(protocolVersion); try { return(CoordinationContext.ReadFrom(reader, coordinationXmlDictionaryStrings.CoordinationContext, coordinationXmlDictionaryStrings.Namespace, protocolVersion)); } catch (InvalidCoordinationContextException e) { DiagnosticUtility.TraceHandledException(e, TraceEventType.Error); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionException(SR.GetString(SR.WsatHeaderCorrupt), e)); } }
public MemoryStream WriteHeader() { MemoryStream mem = new MemoryStream(); mem.WriteByte(1); if (CoordinationContext.IsNativeIdentifier(this.logEntry.RemoteTransactionId, this.logEntry.LocalTransactionId)) { mem.WriteByte(1); } else { mem.WriteByte(0); SerializationUtils.WriteString(mem, this.logEntry.RemoteTransactionId); } Guid localEnlistmentId = this.logEntry.LocalEnlistmentId; SerializationUtils.WriteGuid(mem, ref localEnlistmentId); return(mem); }
public override LogEntry DeserializeHeader() { string str; LogEntryHeaderv1Flags flags = (LogEntryHeaderv1Flags)SerializationUtils.ReadByte(base.mem); if (DebugTrace.Verbose) { DebugTrace.Trace(TraceLevel.Verbose, "DeserializeHeader flags: {0}", flags); } this.CheckFlags(flags); if (((byte)(flags & LogEntryHeaderv1Flags.StandardRemoteTransactionId)) == 0) { str = SerializationUtils.ReadString(base.mem); } else { str = CoordinationContext.CreateNativeIdentifier(this.localTransactionId); } return(new LogEntry(str, this.localTransactionId, SerializationUtils.ReadGuid(base.mem))); }
// The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version. /* * // We demand full trust because we call into CoordinationContext and CoordinationStrings, which are defined in a non-APTCA assembly. Also, CoordinationStrings.Version(..) * // does an Environment.FailFast if the argument is invalid. It's recommended to not let partially trusted callers to bring down the process. * // WSATs are not supported in partial trust, so customers should not be broken by this demand. * [PermissionSet(SecurityAction.Demand, Unrestricted = true)] */ public static CoordinationContext GetCoordinationContext(Message message, ProtocolVersion protocolVersion) { CoordinationStrings coordinationStrings = CoordinationStrings.Version(protocolVersion); string locWsatHeaderElement = coordinationStrings.CoordinationContext; string locWsatNamespace = coordinationStrings.Namespace; int index; try { index = message.Headers.FindHeader(locWsatHeaderElement, locWsatNamespace); } catch (MessageHeaderException e) { DiagnosticUtility.TraceHandledException(e, TraceEventType.Warning); return(null); } if (index < 0) { return(null); } CoordinationContext context; XmlDictionaryReader reader = message.Headers.GetReaderAtHeader(index); using (reader) { context = GetCoordinationContext(reader, protocolVersion); } MessageHeaderInfo header = message.Headers[index]; if (!message.Headers.UnderstoodHeaders.Contains(header)) { message.Headers.UnderstoodHeaders.Add(header); } return(context); }
public void CreateCoordinationContext(Message message, Microsoft.Transactions.Wsat.Messaging.RequestAsyncResult result) { Microsoft.Transactions.Wsat.Messaging.CreateCoordinationContext create = new Microsoft.Transactions.Wsat.Messaging.CreateCoordinationContext(message, this.state.ProtocolVersion); CoordinationContext currentContext = create.CurrentContext; if (currentContext == null) { CompletionEnlistment completion = new CompletionEnlistment(this.state); completion.StateMachine.Enqueue(new MsgCreateTransactionEvent(completion, ref create, result)); } else { TransactionContextManager contextManager = this.state.Lookup.FindTransactionContextManager(currentContext.Identifier); if (contextManager == null) { bool flag; contextManager = new TransactionContextManager(this.state, currentContext.Identifier); contextManager = this.state.Lookup.FindOrAddTransactionContextManager(contextManager, out flag); } contextManager.StateMachine.Enqueue(new TransactionContextEnlistTransactionEvent(contextManager, ref create, result)); } }
public static void Trace(Guid enlistmentId, CoordinationContext context, ControlProtocol protocol, EndpointAddress coordinatorService, ProtocolVersion protocolVersion) { RegisterCoordinatorRecordSchema extendedData = RegisterCoordinatorRecordSchema.Instance(context, protocol, coordinatorService, protocolVersion); TxTraceUtility.Trace(TraceEventType.Information, GetCode(protocolVersion), Microsoft.Transactions.SR.GetString("RegisterCoordinator"), extendedData, null, enlistmentId, null); }
public static void WriteElement(XmlDictionaryWriter writer, CoordinationContext context, ProtocolVersion protocolVersion) { CoordinationXmlDictionaryStrings strings = CoordinationXmlDictionaryStrings.Version(protocolVersion); context.WriteTo(writer, strings.CoordinationContext, strings.Namespace); }
public static void Trace(Guid enlistmentId, CoordinationContext context, string reason) { ReasonRecordSchema extendedData = new ReasonRecordSchema(reason); TxTraceUtility.Trace(TraceEventType.Warning, 0xb0002, Microsoft.Transactions.SR.GetString("EnlistTransactionFailure"), extendedData, null, enlistmentId, null); }
protected RegistrationCoordinatorResponseInvalidMetadataSchema(CoordinationContext context, ControlProtocol protocol) { this.context = context; this.protocol = protocol; }
public static void Trace(Guid enlistmentId, CoordinationContext context, ControlProtocol protocol, EndpointAddress coordinatorService, Exception e, ProtocolVersion protocolVersion) { RegistrationCoordinatorResponseInvalidMetadataSchema extendedData = RegistrationCoordinatorResponseInvalidMetadataSchema.Instance(context, protocol, coordinatorService, protocolVersion); TxTraceUtility.Trace(TraceEventType.Warning, GetCode(protocolVersion), Microsoft.Transactions.SR.GetString("RegistrationCoordinatorResponseInvalidMetadata"), extendedData, e, enlistmentId, null); }
//======================================================================================= // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version. /* * // We demand full trust because we use CoordinationContext and CoordinationServiceSecurity from a non-APTCA assembly. * // The CoordinationContext constructor can call Environment.FailFast and it's recommended to not let partially trusted callers to bring down the process. * // WSATs are not supported in partial trust, so customers should not be broken by this demand. * [PermissionSet(SecurityAction.Demand, Unrestricted = true)] */ public void MarshalAsCoordinationContext(Transaction transaction, out CoordinationContext context, out RequestSecurityTokenResponse issuedToken) { Guid transactionId = transaction.TransactionInformation.DistributedIdentifier; string nonNativeContextId = null; context = new CoordinationContext(this.protocolVersion); // Get timeout, description and isolation flags uint timeout; IsolationFlags isoFlags; string description; OleTxTransactionFormatter.GetTransactionAttributes(transaction, out timeout, out isoFlags, out description); context.IsolationFlags = isoFlags; context.Description = description; // If we can, use cached extended information // Note - it may be worth using outgoing contexts more than once. // We'll let performance profiling decide that question WsatExtendedInformation info; if (WsatExtendedInformationCache.Find(transaction, out info)) { context.Expires = info.Timeout; // The extended info cache only contains an identifier when it's non-native if (!string.IsNullOrEmpty(info.Identifier)) { context.Identifier = info.Identifier; nonNativeContextId = info.Identifier; } } else { context.Expires = timeout; if (context.Expires == 0) { // If the timeout is zero, there are two possibilities: // 1) This is a root transaction with an infinite timeout. // 2) This is a subordinate transaction whose timeout was not flowed. // We have no mechanism for distinguishing between the two cases. // // We could always return zero here, instead of using the local max timeout. // The problem is that the 2004/08 WS-C spec does not specify the meaning // of a zero expires field. While we accept zero to mean "as large as possible" // it would be risky to expect others to do the same. So we only propagate // zero in the expires field if the local max timeout has been disabled. // // This is MB 34596: how can we flow the real timeout? context.Expires = (uint)TimeoutHelper.ToMilliseconds(this.wsatConfig.MaxTimeout); } } if (context.Identifier == null) { context.Identifier = CoordinationContext.CreateNativeIdentifier(transactionId); nonNativeContextId = null; } string tokenId; if (!this.wsatConfig.IssuedTokensEnabled) { tokenId = null; issuedToken = null; } else { CoordinationServiceSecurity.CreateIssuedToken(transactionId, context.Identifier, this.protocolVersion, out issuedToken, out tokenId); } AddressHeader refParam = new WsatRegistrationHeader(transactionId, nonNativeContextId, tokenId); context.RegistrationService = wsatConfig.CreateRegistrationService(refParam, this.protocolVersion); context.IsolationLevel = transaction.IsolationLevel; context.LocalTransactionId = transactionId; if (this.wsatConfig.OleTxUpgradeEnabled) { context.PropagationToken = TransactionInterop.GetTransmitterPropagationToken(transaction); } }
public RegistrationCoordinatorFailedSchema(CoordinationContext context, ControlProtocol protocol) { this.context = context; this.protocol = protocol; }
public Transaction UnmarshalTransaction(WsatTransactionInfo info) { if (info.Context.ProtocolVersion != this.protocolVersion) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new ArgumentException(SR.GetString(SR.InvalidWsatProtocolVersion))); } if (wsatConfig.OleTxUpgradeEnabled) { byte[] propToken = info.Context.PropagationToken; if (propToken != null) { try { return(OleTxTransactionInfo.UnmarshalPropagationToken(propToken)); } catch (TransactionException e) { DiagnosticUtility.TraceHandledException(e, TraceEventType.Warning); } // Fall back to WS-AT unmarshal if (DiagnosticUtility.ShouldTraceInformation) { TraceUtility.TraceEvent(TraceEventType.Information, TraceCode.TxFailedToNegotiateOleTx, SR.GetString(SR.TraceCodeTxFailedToNegotiateOleTx, info.Context.Identifier)); } } } // Optimization: if the context's registration service points to our local TM, we can // skip the CreateCoordinationContext step CoordinationContext localContext = info.Context; if (!this.wsatConfig.IsLocalRegistrationService(localContext.RegistrationService, this.protocolVersion)) { // Our WS-AT protocol service for the context's protocol version should be enabled if (!this.wsatConfig.IsProtocolServiceEnabled(this.protocolVersion)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new TransactionException(SR.GetString(SR.WsatProtocolServiceDisabled, this.protocolVersion))); } // We should have enabled inbound transactions if (!this.wsatConfig.InboundEnabled) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new TransactionException(SR.GetString(SR.InboundTransactionsDisabled))); } // The sender should have enabled both WS-AT and outbound transactions if (this.wsatConfig.IsDisabledRegistrationService(localContext.RegistrationService)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new TransactionException(SR.GetString(SR.SourceTransactionsDisabled))); } // Ask the WS-AT protocol service to unmarshal the transaction localContext = CreateCoordinationContext(info); } Guid transactionId = localContext.LocalTransactionId; if (transactionId == Guid.Empty) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new TransactionException(SR.GetString(SR.InvalidCoordinationContextTransactionId))); } byte[] propagationToken = MarshalPropagationToken(ref transactionId, localContext.IsolationLevel, localContext.IsolationFlags, localContext.Description); return(OleTxTransactionInfo.UnmarshalPropagationToken(propagationToken)); }