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

C# wcf客户端生成的代码需要构造函数参数,c#,wcf,constructor,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.Cl

当我跟随链接时,它给了我一个例子

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
callback)作为参数

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>

遵循以下步骤

  • 暴露端点
  • 在代码中创建服务引用
  • 使用上述cod

  • 它是双工服务吗?是的,它是双工服务,所以在双工服务中它是必需的。这里有一个链接,谢谢。工作得很有魅力