2011-12-29 27 views
1

这与其他Stack帖子类似,但略有不同,因为我只托管单个wsHttp端点(和mex)。当我将httpsGetUrl留空时,它显示服务器名称,而不是我需要的公用URI(对于wsdl)WCF HttpsGetUrl URI的注册已存在

这里是配置的重要部分。

<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> 

有什么建议吗?

回答

4

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

<behavior name="myServiceBehaviors"> 
    <useRequestHeadersForMetadataAddress /> 
    <serviceDebug includeExceptionDetailInFaults="true" /> 
    <serviceMetadata httpsGetEnabled="true" /> 
</behavior>