MessageQueue.Delete-Methode
Löschte eine Warteschlange auf einem Message Queuing-Server.
Namespace: System.Messaging
Assembly: System.Messaging (in system.messaging.dll)
Syntax
'Declaration
Public Shared Sub Delete ( _
path As String _
)
'Usage
Dim path As String
MessageQueue.Delete(path)
public static void Delete (
string path
)
public:
static void Delete (
String^ path
)
public static void Delete (
String path
)
public static function Delete (
path : String
)
Parameter
- path
Der Speicherort der zu löschenden Warteschlange.
Ausnahmen
Ausnahmetyp | Bedingung |
---|---|
Der path-Parameter ist NULL (Nothing in Visual Basic) oder eine leere Zeichenfolge (""). |
|
Die Syntax für den path-Parameter ist ungültig. - oder - Fehler beim Zugriff auf eine Message Queuing-Methode. |
Hinweise
Die Syntax für den path-Parameter hängt vom Typ der Warteschlange ab.
Warteschlangentyp |
Syntax |
---|---|
Öffentliche Warteschlange |
MachineName\QueueName |
Private Warteschlange |
MachineName\Private$\QueueName |
Weitere Informationen zur Syntax finden Sie unter der Path-Eigenschaft.
Sie können auch FormatName oder Label zur Angabe des Pfades für die Warteschlange verwenden.
Verweis |
Syntax |
---|---|
Formatname |
FormatName:[ format name ] |
Bezeichnung |
Label:[ label ] |
Der folgenden Tabelle können Sie entnehmen, ob diese Methode in verschiedenen Arbeitsgruppenmodi verfügbar ist.
Arbeitsgruppenmodus |
Verfügbar |
---|---|
Lokaler Computer |
Ja |
Lokaler Computer + direkter Formatname |
Ja |
Remotecomputer |
Nein |
Lokaler Computer + direkter Formatname |
Nein |
Beispiel
Im folgenden Codebeispiel wird eine Message Queuing-Warteschlange gelöscht, sofern sie vorhanden ist.
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
.NET Framework-Sicherheit
- Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter .
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
MessageQueue-Klasse
MessageQueue-Member
System.Messaging-Namespace
Close
Path