共用方式為


DeliveryStatus 列舉

定義

當訊息的傳遞不確定,或是當訊息未傳遞時,指定訊息傳遞狀態的列舉。

public enum class DeliveryStatus
public enum DeliveryStatus
type DeliveryStatus = 
Public Enum DeliveryStatus
繼承
DeliveryStatus

欄位

InDoubt 0

訊息的傳遞不確定。

NotDelivered 1

未傳遞訊息。

範例

下列範例說明如何存取服務作業內訊息的 DeliveryStatus

public void SimpleSubmitPurchaseOrder(PurchaseOrder po)
{
    Console.WriteLine("Submitting purchase order did not succeed ", po);
    MsmqMessageProperty mqProp = OperationContext.Current.IncomingMessageProperties[MsmqMessageProperty.Name] as MsmqMessageProperty;

    Console.WriteLine("Message Delivery Status: {0} ", mqProp.DeliveryStatus);
    Console.WriteLine("Message Delivery Failure: {0}", mqProp.DeliveryFailure);
    Console.WriteLine();
}
<OperationBehavior(TransactionScopeRequired := True, TransactionAutoComplete := True)> _
Public Sub SimpleSubmitPurchaseOrder(ByVal po As PurchaseOrder)
    Console.WriteLine("Submitting purchase order did not succeed ", po)
    Dim mqProp As MsmqMessageProperty = TryCast(OperationContext.Current.IncomingMessageProperties(MsmqMessageProperty.Name), MsmqMessageProperty)

    Console.WriteLine("Message Delivery Status: {0} ", mqProp.DeliveryStatus)
    Console.WriteLine("Message Delivery Failure: {0}", mqProp.DeliveryFailure)
    Console.WriteLine()
End Sub

備註

傳送給佇列的訊息可能會到達寄不出的信件佇列,這是因為該訊息未傳遞或是佇列管理員不確定傳遞結果。 當從寄不出的信件佇列讀取訊息時, DeliveryStatus 就是取得訊息傳遞狀態的一個方式。

適用於