Freigeben über


MessageQueuePermissionAttribute.MachineName-Eigenschaft

Ruft den Namen des Computers ab, auf dem sich die Message Queuing-Warteschlange befindet, oder legt diesen fest.

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

Syntax

'Declaration
Public Property MachineName As String
'Usage
Dim instance As MessageQueuePermissionAttribute
Dim value As String

value = instance.MachineName

instance.MachineName = value
public string MachineName { get; set; }
public:
property String^ MachineName {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_MachineName ()

/** @property */
public void set_MachineName (String value)
public function get MachineName () : String

public function set MachineName (value : String)

Eigenschaftenwert

Der Name des Computers, auf dem sich die Warteschlange befindet.

Ausnahmen

Ausnahmetyp Bedingung

InvalidOperationException

Der Wert ist NULL (Nothing in Visual Basic).

Beispiel

Im folgenden Codebeispiel wird der Wert der MachineName-Eigenschaft einer Meldungswarteschlangenberechtigung für ein Attribut abgerufen und festgelegt.

// Connect to a queue on the local computer.
MessageQueue queue = new MessageQueue(".\\exampleQueue");

// Create a new instance of MessageQueuePermissionAttribute.
MessageQueuePermissionAttribute attribute =
    new MessageQueuePermissionAttribute(
    System.Security.Permissions.SecurityAction.Assert);

// Set the attribute's MachineName property value, based on the queue's
// MachineName property value.
attribute.MachineName = queue.MachineName;

// Display the new value of the attribute's MachineName property.
Console.WriteLine("attribute.MachineName: {0}",
    attribute.MachineName);
// Connect to a queue on the local computer.
MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue");

// Create a new instance of MessageQueuePermissionAttribute.
MessageQueuePermissionAttribute^ attribute =
    gcnew MessageQueuePermissionAttribute(
    System::Security::Permissions::SecurityAction::Assert);

// Set the attribute's MachineName property value, based on the queue's
// MachineName property value.
attribute->MachineName = queue->MachineName;

// Display the new value of the attribute's MachineName property.
Console::WriteLine("attribute->MachineName: {0}",
    attribute->MachineName);

queue->Close();
// Connect to a queue on the local computer.
MessageQueue queue = new MessageQueue(".\\exampleQueue");
// Create a new instance of MessageQueuePermissionAttribute.
MessageQueuePermissionAttribute attribute =
    new MessageQueuePermissionAttribute(
    System.Security.Permissions.SecurityAction.Assert);
// Set the attribute's MachineName property value, based on the queue's
// MachineName property value.
attribute.set_MachineName(queue.get_MachineName());
// Display the new value of the attribute's MachineName property.
Console.WriteLine("attribute.MachineName: {0}",
    attribute.get_MachineName());

.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 Millennium Edition, 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

Siehe auch

Referenz

MessageQueuePermissionAttribute-Klasse
MessageQueuePermissionAttribute-Member
System.Messaging-Namespace