如何设置基本WCF服务-客户端应用程序?

如何设置基本WCF服务-客户端应用程序?,wcf,service,reference,client,msdn,Wcf,Service,Reference,Client,Msdn,我是WCF新手,我尝试创建我的第一个WCF服务-客户端应用程序。我使用VisualStudio2010 我创建WCF服务应用程序 我尝试将服务引用添加到我的另一个项目中。按discover后,服务发生了。单击或展开后,会发生错误。我试图修复配置文件,但错误消息正在更改。 保持基本WCF服务工作的最低配置是什么?服务器端配置 <services> <service name="Program01.TestClass" behaviorConfiguration="testB

我是WCF新手,我尝试创建我的第一个WCF服务-客户端应用程序。我使用VisualStudio2010

我创建WCF服务应用程序 我尝试将服务引用添加到我的另一个项目中。按discover后,服务发生了。单击或展开后,会发生错误。我试图修复配置文件,但错误消息正在更改。
保持基本WCF服务工作的最低配置是什么?

服务器端配置

 <services>
  <service name="Program01.TestClass" behaviorConfiguration="testBehavior">
    <endpoint address="" binding="basicHttpBinding"   
     contract="Contracts.IContract"/>
     <host>
      <baseAddresses>
        <add baseAddress="http://localhost:9817/TestService"/>
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="testBehavior">
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceMetadata httpGetEnabled="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<client>
  <endpoint address="http://localhost:9817/TestService" binding="basicHttpBinding" 
   name="ClientEndPoint"
   contract="Contracts.IContract"/>
</client>
客户端配置

 <services>
  <service name="Program01.TestClass" behaviorConfiguration="testBehavior">
    <endpoint address="" binding="basicHttpBinding"   
     contract="Contracts.IContract"/>
     <host>
      <baseAddresses>
        <add baseAddress="http://localhost:9817/TestService"/>
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="testBehavior">
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceMetadata httpGetEnabled="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<client>
  <endpoint address="http://localhost:9817/TestService" binding="basicHttpBinding" 
   name="ClientEndPoint"
   contract="Contracts.IContract"/>
</client>

使用ChannelFactory获取代理并调用该方法。干杯:-

请发布遇到的错误?-1:为什么您认为您的配置有助于OP?