无法从WCF自托管服务读取元数据

时间:2013-02-19 15:42:32

标签: .net wcf

我有一些自托管服务,需要在客户端使用元数据。当我使用WcfTestClient打开服务时,它失败并出现消息“错误:无法从https://localhost:8000/获取元数据” 我该怎么办?

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="PrinterServiceBehavior">
                <serviceMetadata httpGetEnabled="false" httpsGetEnabled="True"/>
                <serviceDebug includeExceptionDetailInFaults="False" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <bindings>
        <wsHttpBinding>
            <binding name="TransportSecurity">
                <security mode="Transport">
                    <transport clientCredentialType="Basic"/>
                </security>
            </binding>
            <binding name="NoSecurity">
                <security mode="None" />
            </binding>
        </wsHttpBinding>
    </bindings>
    <services>
        <service behaviorConfiguration="PrinterServiceBehavior" name="App.PrinterService">
            <host>
                <baseAddresses>
                    <add baseAddress="https://localhost:8000/" />
                </baseAddresses>
            </host>
            <endpoint address="printer" binding="wsHttpBinding" bindingConfiguration="TransportSecurity" contract="App.IPrinterService" />
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
        </service>
    </services>
</system.serviceModel>

1 个答案:

答案 0 :(得分:0)

您是否使用HTTP.SYS配置了SSL证书以获取自我主机工作的SSL? Here是一篇很好的博客文章,介绍了如何使用selfhost配置SSL。

相关问题