C# 无法在WCF中创建代理对象

C# 无法在WCF中创建代理对象,c#,wcf,wcf-client,C#,Wcf,Wcf Client,我正在使用此链接中的WCF服务: 现在,如果您向下滚动此链接,他们会给出如何创建客户端的示例: private void CreateClient(int mid) { ClientRecord client = new ClientRecord(); client.MerchantID = MerchantID; client.FirstName = "Bob"; client.LastName = "Smith"; //other code

我正在使用此链接中的WCF服务:

现在,如果您向下滚动此链接,他们会给出如何创建客户端的示例:

    private void CreateClient(int mid)
{
    ClientRecord client = new ClientRecord();
    client.MerchantID = MerchantID;
    client.FirstName = "Bob";
    client.LastName = "Smith";
    //other code describing client omitted

    try
    {
        using (ClientServiceClient proxy = new ClientServiceClient())
        {
            int id = proxy.createClient(Authenticate.GetClientAuthTicket(txtID.Text.Trim(), txtKey.Text.Trim()), client);
            Response.Write("Created Client ID = " + id.ToString());
        }
    }
    catch (Exception e)
    {
      Response.Write(e.Message);
    }
}
现在我不明白这是什么:ClientServiceClient???我创建了如下实现:

 public static PaymentsGatewayTest.Authentication GetClientAuthTicket (string APILogin, string key)
    {
        PaymentsGatewayTest.Authentication ticket = new PaymentsGatewayTest.Authentication();
        ticket.APILoginID = APILogin;
        ticket.UTCTime = DateTime.UtcNow.Ticks.ToString();
        ticket.TSHash = GenerateTSHash(ticket.APILoginID + "|" + ticket.UTCTime, key.Trim());
        return ticket;
    }

         private void CreateClient(int mid)
    {
        ClientRecord client = new ClientRecord();
        client.MerchantID = 11245;
        client.FirstName = "Bob";
        client.LastName = "Smith";
        //other code describing client omitted

        try
        {
            using (PaymentsAuthClient proxy = new PaymentsAuthClient())
            {

                int id = proxy.createClient(Authenticate.GetClientAuthTicket("", "", client));
                //Response.Write("Created Client ID = " + id.ToString());
            }
        }
        catch (Exception e)
        {
            //Response.Write(e.Message);
        }
    }

我创建了一个名为PaymentsAuthClient的单例类,但这似乎不起作用。我做错了什么


感谢您在adv:)

中提供的帮助,如果您按照示例源的链接进行操作:

您将看到它们对客户端web服务有一个连接,并且ClientServiceClient由Visual studio根据引用自动生成

他们的示例是对以下内容的服务引用:

如果查看
servicestclient\Service References\ClientService
文件夹中的reference.cs文件,您将看到该客户端被调用:

.....yournamespace.....ClientService.ClientServiceClient
服务名称是名称空间,因此我认为您可能需要:

 .....yournamespace.....PaymentsAuthClient.ClientServiceClient

谢谢普里特,我也用同样的方式创作了。我的服务参考名称是:PaymentsAuthClient。那么我在这里遗漏了什么?“但这似乎不起作用”&发生了什么?