消费端的休息Wcf服务问题

时间:2013-12-12 06:18:18

标签: c# wcf

我在VS2010中开发了一个WCF服务.EVery工作正常。但是当我转换为restful服务,而不是在消费端工作(控制台应用程序)。 获取错误:ChannelFactory.Endpoint上的Address属性为null。 ChannelFactory的端点必须指定有效的地址。 WCF restful service的web.config设置:

<services>
      <service behaviorConfiguration="DashBoardService.Service1Behavior"
        name="DashBoardService.Service1">
        <endpoint address=""  binding="webHttpBinding" contract="DashBoardService.IDashBoard" behaviorConfiguration="Web">
          <!--behaviorConfiguration="restfulBehavior" ,behaviorConfiguration="Web"-->
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
</services>
<behaviors>

      <endpointBehaviors>
        <behavior name="Web">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="DashBoardService.Service1Behavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

不知道在哪里做错了。请帮我解决这个问题。

0 个答案:

没有答案