Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF Service not Processing MSMQ Message
    primarykey
    data
    text
    <p>I have a WCF Windows Service that checks for MSMQ messages. It picks the messages up ok but the ProcessMSMQMessage event does not seem to get called.</p> <p>Any ideas why this is? Have I set ProcessMSMQMessage event correctly? Or am I missing something?</p> <p>My code is below. Thanks.</p> <p>WCF Service Class...</p> <pre><code>public partial class MyService : ServiceBase { private ServiceHost host; public MyService() { InitializeComponent(); } protected override void OnStart(string[] args) { string queueName = ConfigurationManager.AppSettings["ProcessMsgQueueName"]; if (!MessageQueue.Exists(queueName)) { MessageQueue thisQueue = MessageQueue.Create(queueName, true); thisQueue.SetPermissions("Everyone", MessageQueueAccessRights.ReceiveMessage); } try { Uri serviceUri = new Uri("msmq.formatname:DIRECT=OS:" + queueName); // communicate to MSMQ how to transfer and deliver the messages MsmqIntegrationBinding serviceBinding = new MsmqIntegrationBinding(); serviceBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None; serviceBinding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.None; serviceBinding.SerializationFormat = MsmqMessageSerializationFormat.Binary; host = new ServiceHost(typeof(MyService.Service1)); // add watcher class name host.AddServiceEndpoint(typeof(MyService.IService1), serviceBinding, serviceUri); host.Open(); } catch (Exception ex) { EventLog.WriteEntry("SERVICE" + ex.Message, EventLogEntryType.Error); } } protected override void OnStop() { if (host != null) host.Close(); } } </code></pre> <p>IService1 Contract...</p> <pre><code>[ServiceContract(Namespace = "MyService")] [ServiceKnownType(typeof(Events.Dashboard_Message))] public interface IService1 { [OperationContract(IsOneWay = true)] void ProcessMSMQMessage(MsmqMessage&lt;Events.Dashboard_Message&gt; msg); } </code></pre> <p>Service1 Class...</p> <pre><code>public class Service1 : IService1 { [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)] public void ProcessMSMQMessage(MsmqMessage&lt;Events.Dashboard_Message&gt; msg) { string msgName = msg.GetType().Name; // send to eventlog EventLog.WriteEntry("MyService", msgName); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload