title: "Configuring Services with Endpoints" Demo Fails For Me (Microsoft/endpoint.tv/Pluralsight)
body: <p>I'm trying to follow along with the demo videos on the beginners to WCF page on <a href="http://msdn.microsoft.com/en-us/netframework/dd939784" rel="nofollow noreferrer">MSDN</a>.</p>
  
  <p>The first video worked more or less fine. I'm now towards the end of the second video. I am using VS2010 / .NET 4.0, whereas the video seems to be using VS2008 (I'm assuming .NET 3.5, but I don't recall).</p>
  
  <p><a href="http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Configuring-Services-with-Endpoints/" rel="nofollow noreferrer">I'm using the following demo</a></p>
  
  <p>We've just added 3 more end points: a plain http, net.tcp, and net.pipe. When I try to run the project now the Web service fails to start.</p>
  
  <pre><code>System.InvalidOperationException: Cannot load the X.509 certificate identity specified in the configuration.
     at System.ServiceModel.Description.ConfigLoader.LoadIdentity(IdentityElement element)
     at System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress)
     at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection)
     at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, String configurationName)
     at System.ServiceModel.ServiceHostBase.ApplyConfiguration()
     at System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
     at System.ServiceModel.ServiceHost.InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses)
     at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
     at Microsoft.Tools.SvcHost.ServiceHostHelper.CreateServiceHost(Type type, ServiceKind kind)
     at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info)
  </code></pre>
  
  <p>Based on my Google fu, I came across this thread: <a href="https://stackoverflow.com/questions/530342/cannot-load-the-x-509-certificate-identity-specified-in-the-configuration/7634687#7634687">&quot;Cannot load the X.509 certificate identity specified in the configuration&quot;</a></p>
  
  <p>I really didn't want to get involved in certificates just yet since I'm still just experimenting with the basics so I followed the advice in that post and just added the <code>&lt;dns value="localhost" /&gt;</code> tag. The exception changes:</p>
  
  <pre><code>Please try changing the HTTP port to 8732 or running as Administrator.
  System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:8080/EvalService/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). ---&gt; System.Net.HttpListenerException: Access is denied
     at System.Net.HttpListener.AddAllPrefixes()
     at System.Net.HttpListener.Start()
     at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
     --- End of inner exception stack trace ---
     at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
     at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
     at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
     at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Channels.DatagramChannelDemuxer`2.OnOuterListenerOpen(ChannelDemuxerFilter filter, IChannelListener listener, TimeSpan timeout)
     at System.ServiceModel.Channels.SingletonChannelListener`3.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Security.NegotiationTokenAuthenticator`1.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Security.CommunicationObjectSecurityTokenAuthenticator.Open(TimeSpan timeout)
     at System.ServiceModel.Security.SecurityUtils.OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout)
     at System.ServiceModel.Security.SecurityUtils.OpenTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout)
     at System.ServiceModel.Security.SecurityProtocolFactory.Open(String propertyName, Boolean requiredForForwardDirection, SecurityTokenAuthenticator authenticator, TimeSpan timeout)
     at System.ServiceModel.Security.SymmetricSecurityProtocolFactory.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Security.SecurityProtocolFactory.Open(Boolean actAsInitiator, TimeSpan timeout)
     at System.ServiceModel.Security.SecurityListenerSettingsLifetimeManager.Open(TimeSpan timeout)
     at System.ServiceModel.Channels.SecurityChannelListener`1.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Security.SecuritySessionSecurityTokenAuthenticator.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Security.CommunicationObjectSecurityTokenAuthenticator.Open(TimeSpan timeout)
     at System.ServiceModel.Security.SecurityUtils.OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout)
     at System.ServiceModel.Security.SecurityUtils.OpenTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout)
     at System.ServiceModel.Security.SecuritySessionServerSettings.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Security.SecuritySessionServerSettings.Open(TimeSpan timeout)
     at System.ServiceModel.Security.SecurityListenerSettingsLifetimeManager.Open(TimeSpan timeout)
     at System.ServiceModel.Channels.SecurityChannelListener`1.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
     at System.ServiceModel.Channels.CommunicationObject.Open()
     at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info)
  System.Net.HttpListenerException (0x80004005): Access is denied
     at System.Net.HttpListener.AddAllPrefixes()
     at System.Net.HttpListener.Start()
     at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
  </code></pre>
  
  <p>So, I tried doing what it said: changing the port to be 8732, but the exception is still thrown, this time saying <code>Please try changing the HTTP port to 8732...HTTP could not register URL http://+:8732/EvalService/...</code>. :P</p>
  
  <p>I've tried commenting out the new end points to no avail. Even the original ones fail with this error. Doesn't matter either if I put them back to the original port [not so] 1337.</p>
  
  <p>Here's the App.config, and nothing stands out as problematic:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true" /&gt;
    &lt;/system.web&gt;
    &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service name="EvalServiceLibrary.EvalService"&gt;
          &lt;clear /&gt;
          &lt;endpoint address="ws" binding="wsHttpBinding" contract="EvalServiceLibrary.IEvalService"
            listenUriMode="Explicit"&gt;
            &lt;identity&gt;
              &lt;dns value="localhost" /&gt;
              &lt;certificateReference storeName="My" storeLocation="LocalMachine"
                x509FindType="FindBySubjectDistinguishedName" /&gt;
            &lt;/identity&gt;
          &lt;/endpoint&gt;
          &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"
            listenUriMode="Explicit"&gt;
            &lt;identity&gt;
                &lt;dns value="localhost" /&gt;
                &lt;certificateReference storeName="My" storeLocation="LocalMachine"
                x509FindType="FindBySubjectDistinguishedName" /&gt;
            &lt;/identity&gt;
          &lt;/endpoint&gt;
          &lt;endpoint address="basic" binding="basicHttpBinding" contract="EvalServiceLibrary.IEvalService"
            listenUriMode="Explicit"&gt;
            &lt;identity&gt;
              &lt;dns value="localhost" /&gt;
              &lt;certificateReference storeName="My" storeLocation="LocalMachine"
                x509FindType="FindBySubjectDistinguishedName" /&gt;
            &lt;/identity&gt;
          &lt;/endpoint&gt;
          &lt;endpoint address="net.tcp://localhost:8888/EvalService" binding="netTcpBinding"
            contract="EvalServiceLibrary.IEvalService" listenUriMode="Explicit"&gt;
            &lt;identity&gt;
              &lt;dns value="localhost" /&gt;
              &lt;certificateReference storeName="My" storeLocation="LocalMachine"
                x509FindType="FindBySubjectDistinguishedName" /&gt;
            &lt;/identity&gt;
          &lt;/endpoint&gt;
          &lt;endpoint address="net.pipe://localhost/EvalService" binding="netNamedPipeBinding"
            bindingConfiguration="" contract="EvalServiceLibrary.IEvalService" /&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="http://localhost:8080/EvalService" /&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;serviceMetadata httpGetEnabled="True"/&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="False" /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
    &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>What is wrong / how do I fix it?</p>