WCF HttpsGetUrl URI已存在注册

use*_*819 2 wcf

这与其他Stack发布类似,但略有不同,因为我只托管单个wsHttp端点(和mex).当我将httpsGetUrl留空时,它会显示服务器名称而不是我需要的公共uri(对于wsdl)

这是配置的重要部分.

  <service behaviorConfiguration="myServiceBehaviors" name="WebApplication1.Service1">
    <clear/>

    <endpoint behaviorConfiguration="flatwsdl" address="mex" binding="mexHttpsBinding" bindingConfiguration="mexHttpsBinding"
      contract="IMetadataExchange" listenUriMode="Explicit">         
    </endpoint>

    <endpoint  behaviorConfiguration="flatwsdl" address="wsHttp" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingConfig"
      contract="WebApplication1.IService1" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="myServiceBehaviors">
      <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceMetadata httpsGetEnabled="true" httpsGetUrl="https://mydomain.com/integration/Service1.svc" />
    </behavior>
  </serviceBehaviors>
        <endpointBehaviors>
    <behavior name="flatwsdl">
      <wsdlExtensions />
    </behavior>
  </endpointBehaviors>
</behaviors>
Run Code Online (Sandbox Code Playgroud)

有什么建议?

car*_*ira 5

如果您需要公共URI,则应该使用<useRequestHeadersForMetadataAddress>服务行为中的行为,这正是此行为的用途.

<behavior name="myServiceBehaviors">
  <useRequestHeadersForMetadataAddress />
  <serviceDebug includeExceptionDetailInFaults="true" />
  <serviceMetadata httpsGetEnabled="true" />
</behavior>
Run Code Online (Sandbox Code Playgroud)