title: URL of Stateful Service using OWIN communication listener
body: <p>I used the following example to configure a communication listener for my <code>Stateful Service</code>:</p>
  
  <p><a href="https://github.com/Microsoft/azure-docs/blob/master/articles/service-fabric/service-fabric-reliable-services-communication-webapi.md" rel="nofollow noreferrer">https://github.com/Microsoft/azure-docs/blob/master/articles/service-fabric/service-fabric-reliable-services-communication-webapi.md</a></p>
  
  <p>Relevant snippet:</p>
  
  <pre><code>public Task&lt;string&gt; OpenAsync(CancellationToken cancellationToken)
  {
      var serviceEndpoint = this.serviceContext.CodePackageActivationContext.GetEndpoint(this.endpointName);
      var protocol = serviceEndpoint.Protocol;
      int port = serviceEndpoint.Port;
  
      if (this.serviceContext is StatefulServiceContext)
      {
          StatefulServiceContext statefulServiceContext = this.serviceContext as StatefulServiceContext;
  
          this.listeningAddress = string.Format(
              CultureInfo.InvariantCulture,
              "{0}://+:{1}/{2}{3}/{4}/{5}",
              protocol,
              port,
              string.IsNullOrWhiteSpace(this.appRoot)
                  ? string.Empty
                  : this.appRoot.TrimEnd('/') + '/',
              statefulServiceContext.PartitionId,
              statefulServiceContext.ReplicaId,
              Guid.NewGuid());
      }
  ...
  </code></pre>
  
  <p>Service manifest snippet:</p>
  
  <pre><code>&lt;Endpoints&gt;
    &lt;Endpoint Protocol="http" Name="ServiceEndpoint" Type="Input" Port="8090" /&gt;
    &lt;Endpoint Name="ReplicatorEndpoint" /&gt;
  &lt;/Endpoints&gt;
  </code></pre>
  
  <p>Now when deploy my application, I get my service on URL with all kind of guids:</p>
  
  <blockquote>
    <p><a href="http://localhost:8090/ba794109-bba3-4cdf-8434-d718be264087/131407811483781446/614de30b-14a7-4172-a03d-4e28d23cf28d" rel="nofollow noreferrer">http://localhost:8090/ba794109-bba3-4cdf-8434-d718be264087/131407811483781446/614de30b-14a7-4172-a03d-4e28d23cf28d</a></p>
  </blockquote>
  
  <p>If I try to access <code>http://localhost:8090/</code> on itself, I'm getting error <strong>503</strong></p>
  
  <p>Any way to map the general URL to the Primary partition and replica? Or is it impossible in Stateful Services? In Stateless you will get this out of the box.</p>