0
Imports System.Messaging
Imports System.Collections
Imports MSMQ
Imports System.IO
Imports System
Imports System.Messaging.MessageQueue
Imports System.Runtime.InteropServices
Public Class PauseOutMessages
'Declare everything to be in the scope of all methods.
Dim mgmt As New MSMQManagement
Dim outqmgmt As MSMQOutgoingQueueManagement
Dim q As New MSMQApplication
Dim outgoingQueues As New ArrayList
Dim myQueue As New MessageQueue("FormatName:DIRECT=OS:myMachine\Private$\myQueue", QueueAccessMode.ReceiveAndAdmin)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For Each queue In q.ActiveQueues
If queue.IndexOf("DIRECT=") >= 0 Then
outgoingQueues.Add(queue)
End If
Next
End Sub
Private Sub Pause_Click(sender As Object, e As EventArgs) Handles Pause.Click
For Each queuePath In outgoingQueues
mgmt.Init(FormatName:=queuePath)
outqmgmt = mgmt.Pause()
Next
End Sub
Private Sub Restart_Click(sender As Object, e As EventArgs) Handles Restart.Click
For Each queuePath In outgoingQueues
mgmt.Init(FormatName:=queuePath)
outqmgmt = mgmt.Resume()
Next
End Sub
Private Sub Send_Click(sender As Object, e As EventArgs) Handles Send.Click
myQueue.Send("Test")
For Each queue In q.ActiveQueues
If queue.IndexOf("DIRECT=") >= 0 Then
outgoingQueues.Add(queue)
End If
Next
End Sub
End Class
을 다시는 내가 원하는 나가는 대기열에 걸리면 존재하지 않는 경로로 테스트 메시지를 보내, 내가 사용하고있는 코드입니다 MSMQOutgoingQueueManagement.Pause 또는 .Resume을 호출하여 모든 보내는 큐를 시작하고 중지 할 수 있습니다.일시 정지하려고 액세스 거부 오류를 얻기/발신 메시지 큐 여기
그러나 mgmt.Pause() 또는 mgmt.Resume()에서 액세스가 거부되었다는 오류가 계속 발생합니다. 보안 설정을 조정할 수 있도록 나가는 큐의 속성에 접근 할 수있는 방법을 찾지 못하는 것 같습니다. 어떤 도움이라도 대단히 감사하겠습니다!
[다른 사용자가 만든 개인 큐에 대한 MSMQ 사용 권한 설정] (https://stackoverflow.com/q/4603787/1115360)에서 단서를 찾을 수 있습니까? –
Andrew Morton, 나는이 메시지를 보았습니다. 나가는 메시지 큐를 오른쪽 클릭했을 때 속성 옵션이 없었습니다. 일시 중지하거나 다시 시작할 수있는 옵션 만 프로그래밍 방식으로 시도했습니다. 감사 –