【问题标题】:Metadata can not be read from WCF self hosted service无法从 WCF 自托管服务读取元数据
【发布时间】:2013-02-20 00:50:12
【问题描述】:

我有一些自托管服务,需要在客户端使用元数据。当我使用 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>

【问题讨论】:

标签: .net wcf


【解决方案1】:

您是否已使用 HTTP.SYS 配置您的 SSL 证书以使 SSL 与自主机工作? Here 是一篇很好的博客文章,它解释了如何使用 selfhost 配置 SSL。

【讨论】:

    猜你喜欢
    • 2016-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-21
    • 1970-01-01
    相关资源
    最近更新 更多