Eksportér (0) Udskriv
Udvid alt
EN
Dette indhold er ikke tilgængeligt på dit sprog, men her er den engelske version.

Appendix: Messaging Exceptions

Updated: September 17, 2014

This section lists the various exceptions generated by the Microsoft Azure Service Bus messaging API. This reference is subject to change, so check back for updates.

The messaging APIs generate exceptions that can fall into the following categories, along with the associated action you can take to try to fix them:

  1. User code error (ArgumentException, InvalidOperationException, OperationCanceledException, SerializationException). General action: try to fix the code before proceeding.

  2. Setup/configuration error (MessagingEntityNotFoundException, UnauthorizedAccessException. General action: review your configuration and change if necessary.

  3. Transient exceptions (MessagingException, ServerBusyException, MessagingCommunicationException). General action: retry the operation or notify users.

  4. Other exceptions (TransactionException, TimeoutException, MessageLockLostException/SessionLockLostException). General action: you generally do not handle these exceptions to perform cleanup or aborts. They might be used for tracing.

The following table lists messaging exception types, and their causes, and notes suggested action you can take.

 

Exception Type Description/Cause/Examples Suggested Action Note on automatic/immediate retry

TimeoutException

The server did not respond to the requested operation within the specified time which is controlled by OperationTimeout. The server may have completed the requested operation.This can happen due to network or other infrastructure delays.

Check the system state for consistency and retry if necessary.

Retry might help in some cases; add retry logic to code.

InvalidOperationException

The requested user operation is not allowed within the server or service. See the exception message for details. For example, Complete will generate this exception if the message was received in ReceiveAndDelete mode.

Check the code and the documentation. Make sure the requested operation is valid.

Retry will not help.

OperationCanceledException

An attempt is made to invoke an operation on an object that has already been closed, aborted or disposed.In rare cases, the ambient transaction is already disposed.

Check the code and make sure it does not invoke operations on a disposed object.

Retry will not help.

UnauthorizedAccessException

The TokenProvider object could not acquire a token, the token is invalid, or the token does not contain the claims required to perform the operation.

Make sure the token provider is created with the correct values. Check the configuration of the Access Control service.

Retry might help in some cases; add retry logic to code.

ArgumentException

ArgumentNullException

ArgumentOutOfRangeException

  • One or more arguments supplied to the method are invalid.

  • The URI supplied to NamespaceManager or Create contains path segment(s).

  • The URI scheme supplied to NamespaceManager or Create is invalid.

  • The property value is larger than 32KB.

Check the calling code and make sure the arguments are correct.

Retry will not help.

MessagingEntityNotFoundException

Entity associated with the operation does not exist or it has been deleted.

Make sure the entity exists.

Retry will not help.

MessageNotFoundException

Attempt to receive a message with a particular sequence number. This message is not found.

Make sure the message has not been received already. Check the deadletter queue to see if the message has been deadlettered.

Retry will not help.

MessagingCommunicationException

Client is not able to establish a connection to Service Bus.

Make sure the supplied host name is correct and the host is reachable.

Retry might help if there are intermittent connectivity issues.

ServerBusyException

Service is not able to process the request at this time.

Client can wait for a period of time, then retry the operation.

Client may retry after certain interval. If a retry results in a different exception, check retry behavior of that exception.

MessageLockLostException

Lock token associated with the message has expired, or the lock token is not found.

Dispose the message.

Retry will not help.

SessionLockLostException

Lock associated with this session is lost.

Abort the MessageSession object.

Retry will not help.

MessagingException

Generic messaging exception that may be thrown in the following cases:

  • An attempt is made to create a QueueClient using a name or path that belongs to a different entity type (for example, a topic).

  • An attempt is made to send a message larger than 256KB.

  • The server or service encountered an error during processing of the request. Please see the exception message for details. This is usually a transient exception.

  • Check the code and ensure that only serializable objects are used for the message body (or use a custom serializer).

  • Check the documentation for the supported value types of the properties and only use supported types.

  • Check the IsTransient property. If it is true, you can retry the operation.

Retry behavior is undefined and might not help.

MessagingEntityAlreadyExistsException

Attempt to create an entity with a name that is already used by another entity in that service namespace.

Delete the existing entity or choose a different name for the entity to be created.

Retry will not help.

QuotaExceededException

The messaging entity has reached its maximum allowable size.

Create space in the entity by receiving messages from the entity or its sub-queues.

Retry might help if messages have been removed in the meantime.

RuleActionException

Service Bus returns this exception if you attempt to create an invalid rule action. Service Bus attaches this exception to a deadlettered message if an error occurs while processing the rule action for that message.

Check the rule action for correctness.

Retry will not help.

FilterException

Service Bus returns this exception if you attempt to create an invalid filter. Service Bus attaches this exception to a deadlettered message if an error occurred while processing the filter for that message.

Check the filter for correctness.

Retry will not help.

SessionCannotBeLockedException

Attempt to accept a session with a specific session ID, but the session is currently locked by another client.

Make sure the session is unlocked by other clients.

Retry might help if the session has been released in the interim.

TransactionSizeExceededException

Too many operations are part of the transaction.

Reduce the number of operations that are part of this transaction.

Retry will not help.

MessagingEntityDisabledException

Request for a runtime operation on a disabled entity.

Activate the entity.

Retry might help if the entity has been activated in the interim.

NoMatchingSubscriptionException

Service Bus returns this exception if you send a message to a topic that has pre-filtering enabled and none of the filters match.

Make sure at least one filter matches.

Retry will not help.

MessageSizeExceededException

A message payload exceeds the 256K limit. Note that the 256k limit is the total message size, which can include system properties and any .NET overhead.

Reduce the size of the message payload, then retry the operation.

Retry will not help.

TransactionException

The ambient transaction (Current) is invalid. It may have been completed or aborted. Inner exception may provide additional information.

Retry will not help.

TransactionInDoubtException

An operation is attempted on a transaction that is in doubt, or an attempt is made to commit the transaction and the transaction becomes in doubt.

You application must handle this exception (as a special case), as the transaction may have already been committed.

Vis:
© 2014 Microsoft