title: How can I host a WCF REST service at the service root address (without trailing slash)?
body: <p>I have a service hosted using wsHttpBinding on an address (the host base address is <a href="http://localhost/MyService" rel="nofollow">http://localhost/MyService</a>).</p>
  
  <p>In my contract (<code>IMyService</code>), I have:</p>
  
  <pre><code>    [OperationContract]
      [WebInvoke(
          Method = "GET",
          UriTemplate = "/")]
      Stream GetRootPage();
  </code></pre>
  
  <p>If I run my service and browse to <a href="http://localhost/MyService/" rel="nofollow">http://localhost/MyService/</a>, it works fine.  If I browse to <a href="http://localhost/MyService" rel="nofollow">http://localhost/MyService</a>, I am greeted with a default WCF page indicating that the metadata publishing service is not enabled for this service.</p>
  
  <p>I have tried various combinations of UriTemplate:</p>
  
  <ul>
  <li>UriTemplate = ""</li>
  <li>UriTemplate = "/"</li>
  <li>UriTemplate = "*"</li>
  </ul>
  
  <p>In combination with the service base address:</p>
  
  <ul>
  <li><a href="http://localhost/MyService" rel="nofollow">http://localhost/MyService</a></li>
  <li><a href="http://localhost/MyService/" rel="nofollow">http://localhost/MyService/</a></li>
  </ul>
  
  <p>All of them yield the same behavior.  At some point previously, I could have sworn this was working, though I think I may have been using a subpath in the UriTemplate.  I know that if I have a UriTemplate of "/abc/123/", I can browse to /abc/123 (without the trailing slash) because WCF actually issues an HTTP 307 redirect automatically.</p>
  
  <p>I am using .NET 4.0.</p>