Freigeben über


MessageQueueException-Klasse

Die Ausnahme, die ausgelöst wird, wenn ein interner Fehler in Microsoft Message Queuing auftritt.

Namespace: System.Messaging
Assembly: System.Messaging (in system.messaging.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class MessageQueueException
    Inherits ExternalException
    Implements ISerializable
'Usage
Dim instance As MessageQueueException
[SerializableAttribute] 
public class MessageQueueException : ExternalException, ISerializable
[SerializableAttribute] 
public ref class MessageQueueException : public ExternalException, ISerializable
/** @attribute SerializableAttribute() */ 
public class MessageQueueException extends ExternalException implements ISerializable
SerializableAttribute 
public class MessageQueueException extends ExternalException implements ISerializable

Hinweise

Ausnahmen, die der MessageQueueException-Klasse zugeordnet sind, werden durch interne Fehler in Message Queuing generiert, die über den Code behandelt werden müssen.

Jede Ausnahme besteht aus einem Fehlercode und einer Textzeichenfolge, die die Ursache des Fehlers beschreibt. Eine Liste dieser Fehlercodes und ihrer Beschreibungen finden Sie unter der MessageQueueErrorCode-Klasse.

Beispiel

Imports System
Imports System.Messaging



Public Class MyNewQueue


        
        ' Provides an entry point into the application.
        '        
        ' This example verifies existence and attempts to 
        ' delete a queue.
        

        Public Shared Sub Main()

            ' Determine whether the queue exists.
            If MessageQueue.Exists(".\myQueue") Then

                Try

                    ' Delete the queue.
                    MessageQueue.Delete(".\myQueue")

                Catch e As MessageQueueException

                    If e.MessageQueueErrorCode = _
                        MessageQueueErrorCode.AccessDenied Then

                        Console.WriteLine("Access is denied. " _
                            + "Queue might be a system queue.")
                    End If

                    ' Handle other sources of exceptions as necessary.

                End Try

            End If


            Return

        End Sub 'Main

End Class 'MyNewQueue 
using System;
using System.Messaging;

namespace MyProject
{
    /// <summary>
    /// Provides a container class for the example.
    /// </summary>
    public class MyNewQueue
    {

        //**************************************************
        // Provides an entry point into the application.
        //       
        // This example verifies existence and attempts to 
        // delete a queue.
        //**************************************************

        public static void Main()
        {

            // Determine whether the queue exists.
            if (MessageQueue.Exists(".\\myQueue"))
            {
                try
                {
                    // Delete the queue.
                    MessageQueue.Delete(".\\myQueue");
                }
                catch(MessageQueueException e)
                {
                    if(e.MessageQueueErrorCode == 
                        MessageQueueErrorCode.AccessDenied)
                    {
                        Console.WriteLine("Access is denied. " + 
                            "Queue might be a system queue.");
                    }

                    // Handle other sources of MessageQueueException.
                }

            }
        
            return;
        }

    }
}
#using <system.dll>
#using <system.messaging.dll>

using namespace System;
using namespace System::Messaging;
int main()
{
   
   // Determine whether the queue exists.
   if ( MessageQueue::Exists( ".\\myQueue" ) )
   {
      try
      {
         
         // Delete the queue.
         MessageQueue::Delete( ".\\myQueue" );
      }
      catch ( MessageQueueException^ e ) 
      {
         if ( e->MessageQueueErrorCode == MessageQueueErrorCode::AccessDenied )
         {
            Console::WriteLine( "Access is denied. Queue might be a system queue." );
         }
         
         // Handle other sources of MessageQueueException.
      }

   }

   return 0;
}
package MyProject;

import System.*;
import System.Messaging.*;

/// <summary>
/// Provides a container class for the example.
/// </summary>
public class MyNewQueue
{
    //**************************************************
    // Provides an entry point into the application.
    //         
    // This example verifies existence and attempts to 
    // delete a queue.
    //**************************************************
    public static void main(String[] args)
    {
        // Determine whether the queue exists.
        if (MessageQueue.Exists(".\\myQueue")) {
            try {
                // Delete the queue.
                MessageQueue.Delete(".\\myQueue");
            }
            catch (MessageQueueException e) {
                if (e.get_MessageQueueErrorCode().
                    Equals(MessageQueueErrorCode.AccessDenied)) {
                    Console.WriteLine("Access is denied. "
                        + "Queue might be a system queue.");
                }
                // Handle other sources of MessageQueueException.
            }
        }        
        return;
    } //main
} //MyNewQueue 

Vererbungshierarchie

System.Object
   System.Exception
     System.SystemException
       System.Runtime.InteropServices.ExternalException
        System.Messaging.MessageQueueException

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0

Siehe auch

Referenz

MessageQueueException-Member
System.Messaging-Namespace
MessageQueueErrorCode-Enumeration
MessageQueue-Klasse
Message-Klasse