无法从http:// localhost:12659获取元数据

时间:2014-01-24 07:54:45

标签: wcf config

在我的配置中,我的地址详情如下net.tcp://127.0.0.1:1127/CalculatorService but when the error message is showing Cannot obtain Metadata from http://localhost:12659

我有tcp绑定的简单服务,我正在使用wcf测试客户端从VS2010 IDE运行我的服务,然后我收到此错误无法从<{strong> http://localhost:12659获取元数据

这是我的配置文件详细信息

<?xml version="1.0"?>
<!--Copyright (c) Microsoft Corporation.  All Rights Reserved.-->
<configuration>
    <system.serviceModel>
        <services>
            <service name="MyTcpActivation.CalculatorService" behaviorConfiguration="CalculatorServiceBehavior">

                <host>
                    <baseAddresses>
                        <add baseAddress="net.tcp://127.0.0.1:1127/CalculatorService/"/>
                    </baseAddresses>
                </host>

                <endpoint address=""
                binding="netTcpBinding" bindingConfiguration="PortSharingBinding"
                contract="MyTcpActivation.ICalculator"/>

                <endpoint address="mex"
                binding="mexTcpBinding" 
                contract="IMetadataExchange"/>
            </service>
        </services>

        <bindings>
            <netTcpBinding>
                <binding name="PortSharingBinding" portSharingEnabled="true">
                    <security mode="None"/>
                </binding>
            </netTcpBinding>
        </bindings>
        <!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
        <behaviors>
            <serviceBehaviors>
                <behavior name="CalculatorServiceBehavior">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="false"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
    <system.web>
        <compilation debug="true"/></system.web>

</configuration>

请帮我从VS2010 IDE的wcf测试客户端运行我的服务。感谢

1 个答案:

答案 0 :(得分:4)

这表明WCF上存在激活问题。当您的service / config / env。

出现问题时,不会公开元数据

要获取错误消息,请尝试在浏览器中打开http://localhost:12659和/或检查事件日志。

由于它是一个nettcpbinding,配置稍微复杂一点,特别是如果你在IIS下托管服务:检查WAS服务是否已启动,Net Tcp Listener Service是否已启动,net.tcp是否为您网站的激活协议,配置绑定在端口1127上配置ntc.tcp,...)。您也可以先尝试basicHttpBinding。

出于调试目的,将includeExceptionDetailInFaults属性设置为 true

  <behaviors>
        <serviceBehaviors>
            <behavior name="CalculatorServiceBehavior">
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>