MessageQueue.Delete(String) Methode

Definitie

Hiermee verwijdert u een wachtrij op een Message Queuing-server.

public:
 static void Delete(System::String ^ path);
public static void Delete(string path);
static member Delete : string -> unit
Public Shared Sub Delete (path As String)

Parameters

path
String

De locatie van de wachtrij die moet worden verwijderd.

Uitzonderingen

De path parameter is null of is een lege tekenreeks ("").

De syntaxis voor de path parameter is ongeldig.

– of –

Er is een fout opgetreden bij het openen van een Message Queuing-methode.

Voorbeelden

In het volgende codevoorbeeld wordt een Message Queuing-wachtrij verwijderd, als deze bestaat.

#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;
}
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;
        }
    }
}
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

End Class

Opmerkingen

De syntaxis voor de path parameter is afhankelijk van het type wachtrij.

Wachtrijtype Syntax
Openbare wachtrij MachineName\QueueName
Privéwachtrij MachineName\Private$\QueueName

Zie de Path eigenschap voor meer syntaxis.

U kunt ook het FormatName wachtrijpad gebruiken of Label beschrijven.

Referentie Syntax
Indelingsnaam FormatName:[ format name ]
Label Label:[ label ]

In de volgende tabel ziet u of deze methode beschikbaar is in verschillende werkgroepmodi.

Werkgroepmodus Beschikbaar
Lokale computer Yes
Naam van lokale computer en directe indeling Yes
Externe computer No
Naam van externe computer en directe indeling No

Van toepassing op

Zie ook