【问题标题】:WCF consume whilst being consumedWCF 在被消费的同时消费
【发布时间】:2015-08-06 17:52:12
【问题描述】:

作为一名学生员工,我必须建立一个三层项目。

1) 客户的客户

2) 客户网络服务器

3) 运行在我公司网络上的服务器

(一切都通过 tcp 连接运行)

客户使用客户网络上的服务,而客户又使用我公司网络上的服务。

我可以在客户端和中间服务器之间执行 WCF 连接,在中间服务器和公司服务器之间执行 WCF 连接。

但是,当客户的服务在被客户使用的同时尝试使用公司的服务时,我在客户端收到错误。

错误: mscorlib.dll 中出现“System.ServiceModel.FaultException”类型的未处理异常 附加信息:由于内部错误,服务器无法处理请求。

客户:

var client = new ClientServiceClient();
client.SendData(new Data() { ClientId = "0", AppId = "0", Area = "Area", Subject = "Testing..", Project = "BugService", Priority = "3", AssignedTo = "JCA" });

中间服务:

public void SendData(Data data)
{
    Console.WriteLine(data.Subject);
    Console.WriteLine("1");
    var client = new ServiceClient();
    client.SendData(data);
    Console.WriteLine("2");
}

公司服务:

public void SendData(Data data)
{
    Console.WriteLine("1");
    var actions = DatabaseClient.GetActions(data.ClientId, data.AppId);
    Console.WriteLine("2");
    var report = new Report {Data = data};
    Console.WriteLine("3");
    report.CallPlugins(actions);
    Console.WriteLine("ClientId: {0}, AppId: {1}, Action: {2}, Subject: {3}", data.ClientId, data.AppId, actions, data.Subject);
}

中间服务只打印主题和“1”,而不是“2”。 该公司的服务不打印任何内容。

任何帮助将不胜感激! 抱歉,帖子太长了。

【问题讨论】:

    标签: c# .net wcf service client


    【解决方案1】:

    没关系,我犯了一个愚蠢的错误。

    在我的配置文件中,我在客户端和服务标记地址中使用相同的端口..

    <client>
            <endpoint address="net.tcp://localhost:8523/Service" binding="netTcpBinding"
    
    ....
    
    <services>
            <service behaviorConfiguration="ClientService.ServiceBehavior" name="Service.ClientService">
                <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
    

    【讨论】:

      猜你喜欢
      • 2020-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多