wcf客户端生成的代码需要构造函数参数

时间:2015-01-13 09:35:46

标签: c# wcf constructor

当我按照链接时给出的示例

class Test
{
    static void Main()
    {
    InternalCommunicationClient client = new InternalCommunicationClient();

    // Use the 'client' variable to call operations on the service.

    // Always close the client.
    client.Close();
    }
}

但是当我将此代码复制到控制台时,InternalCommunicationClient需要 (InstanceContect回调)作为参数。

我在2年前做过wcf,当时还没有。请帮忙

这是web.conf代码

<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" >
<services>
  <service name="Workflowms.Web.webservices.Internalcommunication.InternalCommunication">
    <endpoint address="" binding="wsDualHttpBinding" contract="Workflowms.Web.webservices.Internalcommunication.IInternalCommunication" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>

1 个答案:

答案 0 :(得分:0)

请按照以下步骤操作

  1. 公开终点
  2. 在您的代码中提供服务参考
  3. 使用上面提到的鳕鱼,