Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/12/2007, 15:41
SportaNinja
 
Fecha de Ingreso: diciembre-2007
Mensajes: 2
Antigüedad: 17 años, 3 meses
Puntos: 0
Problema con win Service

amigos, tengo problemas al ejecutar un service de Windows, que escucha de forma asíncronas los mensajes dejados en una cola

cuando coloco esto
Private Shared InQueue As New System.Messaging.MessageQueue("FormatName:DIRECT=T CP:150.0.2.230\PRIVATE$\test", Messaging.QueueAccessMode.SendAndReceive)

Protected Overrides Sub OnStart(ByVal args() As String)
InQueue.Formatter = New System.Messaging.ActiveXMessageFormatter
AddHandler InQueue.ReceiveCompleted, AddressOf MyReceiveCompleted
InQueue.BeginReceive()
EventLog.WriteEntry("Iniciada la asincronía")
End Sub

Private Shared Sub MyReceiveCompleted(ByVal [source] As Object, ByVal asyncResult As ReceiveCompletedEventArgs)
Dim mq As MessageQueue = CType([source], MessageQueue)
Dim m As Message = mq.EndReceive(asyncResult.AsyncResult)
Try
'Debug.Print(m.Body)
mq.BeginReceive()
'Enviamos el mensaje como parámetro

Dim p As New Process
p.StartInfo.FileName = "EscribirMensaje.exe"
p.StartInfo.WorkingDirectory = "c:\forum\exe"
p.StartInfo.Arguments = m.Body.ToString
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal
p.Start()
Catch ex As Exception
'EventLog.WriteEntry(ex.Message)
End Try
End Sub

en un winform, y ejecuto la aplicación 0 problema trabaja bastante bien, pero cuando lo coloco en un winservice, inicializa la cola, pero no gatilla la asincronia

Alguien tiene idea del porque de esto??

Gracias