title: Failing to get MSMQ WCF Window Service to function
body: <p>I'm trying to create a MSMQ WCF service, although I'm having troubles running the code.  It fails when trying to create an instance of the service.  I have MSMQ installed, and can confirm there is a private created called '<em>servicemodelsamples</em>'</p>
  
  <p>When running the service, I received the following error;</p>
  
  <blockquote>
    <p>Service cannot be started. System.InvalidOperationException: There was
    an error opening the queue. Ensure that MSMQ is installed and running,
    the queue exists and has proper authorization to be read from. The
    inner exception may contain additional information. --->
    System.ServiceModel.MsmqException: An error occurred while opening the
    queue:Unrecognized error -1072824283 (0xc00e0025). The  message cannot
    be sent or received from the queue. Ensure that MSMQ is installed and
    running. Also ensure that the queue is available to open with the
    required access mode and authorization.</p>
  </blockquote>
  
  <p>Control Service Interface and Implementation.</p>
  
  <pre><code>[ServiceContract()]
  public interface IControlService
  {
     [OperationContract(IsOneWay = true)]
     void PricingAlert(int eventid, int marketid);
  }
  
  public class ControlService : IControlService
  {
      public ControlService()
      { }
  
      public void PricingAlert(int eventid, int marketid)
      {
          Console.WriteLine("Acknowledged");
      }
  }
  </code></pre>
  
  <p>Service1.cs Service starting code.  </p>
  
  <pre><code>protected override void OnStart(string[] args)
  {
      Thread.Sleep(10000);
      string queueName = Settings.Default["queueName"].ToString();
  
      if (!MessageQueue.Exists(queueName))
          MessageQueue.Create(queueName, true);
  
      if (myServiceHost != null)
      {
          myServiceHost.Close();
      }
      myServiceHost = new ServiceHost(typeof(ControlService));
      myServiceHost.Open();    // *** Code Fails Here
  }
  </code></pre>
  
  <p>The application config;</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" &gt;
        &lt;section name="ControlService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true" /&gt;
    &lt;/system.web&gt;
    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;netMsmqBinding&gt;
          &lt;binding name="netMsmqBindingConfig"&gt;
            &lt;security mode="None"&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
        &lt;/netMsmqBinding&gt;
      &lt;/bindings&gt;
      &lt;services&gt;
        &lt;service name="TheControlService.ControlService" behaviorConfiguration="MSMQBindingBehaviour"&gt;
          &lt;endpoint address="net.msmq://172.26.2.11/private/ServiceModelSamples"
                    binding="netMsmqBinding" bindingConfiguration="netMsmqBindingConfig"
                    contract="TheControlService.IControlService" /&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name="MSMQBindingBehaviour"&gt;
            &lt;serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8000/Hello/" /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
    &lt;/system.serviceModel&gt;
    &lt;system.diagnostics&gt;
      &lt;trace autoflush="true" /&gt;
      &lt;sources&gt;
        &lt;source name="System.ServiceModel"
                switchValue="Information, ActivityTracing"
                propagateActivity="true"&gt;
          &lt;listeners&gt;
            &lt;add name="sdt"
                type="System.Diagnostics.XmlWriterTraceListener"
                initializeData="controlserviceerrors.svclog"  /&gt;
          &lt;/listeners&gt;
        &lt;/source&gt;
      &lt;/sources&gt;
    &lt;/system.diagnostics&gt;
    &lt;applicationSettings&gt;
      &lt;ControlService.Properties.Settings&gt;
        &lt;setting name="queueName" serializeAs="String"&gt;
          &lt;value&gt;.\private$\ServiceModelSamples&lt;/value&gt;
        &lt;/setting&gt;
      &lt;/ControlService.Properties.Settings&gt;
    &lt;/applicationSettings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Any ideas?  I suspect it might because I've based the code on an example which was a winforms application.</p>