다음을 통해 공유


MessageQueue.Delete(String) 메서드

정의

메시지 큐 서버에서 큐를 삭제합니다.

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)

매개 변수

path
String

삭제할 큐의 위치입니다.

예외

path 매개 변수는 null 빈 문자열("")이거나 빈 문자열입니다.

매개 변수의 구문이 path 잘못되었습니다.

-또는-

메시지 큐 메서드에 액세스할 때 오류가 발생했습니다.

예제

다음 코드 예제에서는 메시지 큐가 있는 경우 삭제합니다.

#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

설명

매개 변수의 구문 path 은 큐 유형에 따라 달라집니다.

큐 유형 문법
공용 큐 MachineName\QueueName
프라이빗 큐 MachineName\Private$\QueueName

자세한 구문은 속성을 참조하세요 Path .

또는 큐 경로를 사용 FormatName 하거나 Label 설명할 수 있습니다.

참조 문법
형식 이름 FormatName:[ 형식 이름 ]
라벨 레이블:[ 레이블 ]

다음 표에서는 이 메서드를 다양한 작업 그룹 모드에서 사용할 수 있는지 여부를 보여 줍니다.

작업 그룹 모드 사용 가능
로컬 컴퓨터
로컬 컴퓨터 및 직접 형식 이름
원격 컴퓨터 No
원격 컴퓨터 및 직접 형식 이름 No

적용 대상

추가 정보