title: wcf endpoint relative address
body: <p>I'm just learning wcf and can't understand one very basic thing. </p>
  
  <p>I'm creating a WCF service which I want to be hosted in IIS just like web application with it's own path like <code>http://myhost/myapp/</code> and everything. </p>
  
  <p>I'm creating the WCF service project in VS, I've got an <code>*.svc</code> file describing it, then I define a simple endpoint to it like that:</p>
  
  <pre><code>&lt;endpoint address="" 
            binding="basicHttpBinding" 
            contract="wcf_service_auth.IPshService" /&gt;
  </code></pre>
  
  <p>Then I publish this service like an IIS web application to a virtual directory, let's assume it's name <code>psh_pub</code>, so I can access the service via url <code>http://localhost/psh_pub/pshservice.svc/</code>. It shows me WCF greetings page and gives me a link to WSDL, which gives me correct wsdl description. </p>
  
  <p>That's ok. </p>
  
  <p>The next step - I want to add a MEX endpoint. I add to config:</p>
  
  <pre><code>&lt;endpoint address="mex" 
            binding="mexHttpBinding" 
            contract="IMetadataExchange"/&gt;
  </code></pre>
  
  <p>That's ok too, the endpoint is accessible at address <code>http://localhost/psh_pub/pshservice.svc/mex</code> and <code>WcfTestClient.exe</code> gives me correct config from that url. </p>
  
  <p>Here the problem comes. </p>
  
  <p>I have a WCF service working under IIS and I want to add one more endpoint to it. For example let it be a <code>net.tcp</code> endpoint. The IIS is configured by default to accept <code>net.tcp</code> connections at port 808 and I'm adding <code>net.tcp</code> protocol to properties of my web app, and I want to add an endpoint to my service like that: </p>
  
  <pre><code>&lt;endpoint address=""
            binding="netTcpBinding" 
            contract="wcf_service_auth.IPshService"  /&gt;
  </code></pre>
  
  <p>and now I assume that my service should be accessible via the url <code>net.tcp://localhost:808/psh_pub/pshservice.svc</code>. But it's not. And every "how-to" and manual on the web tells that I should specify full address in the config file like that:</p>
  
  <pre><code>&lt;endpoint address="net.tcp://localhost:808/psh_pub/pshservice.svc" 
            binding="netTcpBinding" 
            contract="wcf_service_auth.IPshService" /&gt;
  </code></pre>
  
  <p>And if I do so, it works. But if host the service in another virtual directory, I'll need to change the config. If I host it on the other server, I'll need to change config. If I host it on multiple servers, I'll have to maintain as many configs as servers I have. </p>
  
  <p>So the main questions is:</p>
  
  <p>Is there any way in WCF to specify a <code>net.tcp</code> (or https) endpoint of a IIS-hosted WCF service without specifying absolute url for it?</p>