套接字连接被中断 - 的CommunicationException [英] The socket connection was aborted - CommunicationException

查看:248
本文介绍了套接字连接被中断 - 的CommunicationException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最初:

  • 我认为这是一个循环引用问题........原来不是这样的。
  • 在该问题源​​于已经不是在所有配置的服务配置。
  • 由于默认值是非常低的,发送大量的数据会使服务崩溃。

方案:

  • 看来我可以在我的WCF服务循环引用,但使用[DataContract(IsReference =真),无助于帮助解决这个问题。
  • 我收到套接字连接被中止的错误这可能是一个错误处理您的信息或接收超时被超过的远程主机,或者潜在的网络资源问题导致本地套接字超时是00:01 :00'
  • 有我错过了什么?

code:

  [DataContract(IsReference =真)
公共类信息
{
    [数据成员]
    公共字符串TopicName {获得;组; }

    [数据成员]
    公共字符串EVENTDATA {获得;组; }

    [数据成员]
    公共SerializableDictionary<字符串,FuturesLineAsset> FuturesLineDictionary {获得;组 ; }
}
 

的思考:

  • 我不知道这是因为我有一个类FuturesAsset,有型BindableDictionary(这是一个自定义对象)的属性,而属性保存FuturesLinesAssets的列表。
  • 如下图:

父:​​

 公共类FuturesAsset
{
    公共字符串ASSETNAME {获得;组; }
    公共BindableDictionary<字符串,FuturesLineAsset> AssetLines {获得;私定; }

    公共FuturesAsset()
    {
        AssetLines =新BindableDictionary<字符串,FuturesLineAsset>();
    }

    公共FuturesAsset(字符串ASSETNAME)
    {
        AssetLines =新BindableDictionary<字符串,FuturesLineAsset>();
        ASSETNAME = ASSETNAME;
    }
}
 

孩子:

 公共类FuturesLineAsset
{

    公共字符串ReferenceAsset {获得;组; }
    公共字符串MID {获得;组; }
    公共双LivePrice {获得;组; }
    公开日期时间录入{获得;组; }
    公开日期时间LastContributedTime {获得;组; }
    公共双S $ P $ {垫搞定;组; }
    公共双关联{获得;组; }
    公开日期时间到期{获得;组; }
    公共双ReferenceCurve {获得;组; }

    公共FuturesLineAsset(字符串MID,串referenceAsset,双livePrice)
    {
        MID = MID;
        ReferenceAsset = referenceAsset;
        ReutersLivePrice = livePrice;
    }
}
 

解决方案

这异常是不相关的循环引用,它只是单纯的超时,当你试图泵吨的数据通过线路。

这是带有WCF的默认值是非常非常低的(这些都在WCF 4被改变,我相信)。有一个阅读这两个博客,他们应该给你如何dethrottle服务的想法:

<一个href="http://weblogs.asp.net/sweinstein/archive/2009/01/03/creating-high-performance-wcf-services.aspx"相对=nofollow>创建高性能的WCF服务

如何扼杀一个WCF服务,帮助prevent DoS攻击,并保持WCF的可扩展性

更新:同时,需要更新一个不同的超时条款有一些在WCF配置不同的超时,并取​​决于它是否是客户端或服务器你谈论你...有这线程读什么每一个手段,你应该能够找出哪一个你需要颠簸起来。 ,你可以只设置每个超时int.max,如果你真的不关心,如果一个电话可以采取一个龙的时间才能完成。

Originally:

  • I thought this was a circular reference problem........turns out it's not.
  • The problem arose from having not configured the service configurations at all.
  • Since the defaults are very low, sending lots of data will make the service collapse.

Scenario:

  • It seems I may have circular references in my WCF service, but using "[DataContract(IsReference=true)]", does nothing to help fix it.
  • I receive the error "The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:01:00'."
  • Have I missed something?

Code:

[DataContract(IsReference=true)]
public class Message
{
    [DataMember]
    public string TopicName { get; set; }

    [DataMember]
    public string EventData { get; set; }

    [DataMember]
    public SerializableDictionary<string, FuturesLineAsset> FuturesLineDictionary { get; set ; }
}

Thoughts:

  • I wonder if it's because I have a class FuturesAsset, that has a property of type BindableDictionary (THIS IS A CUSTOM OBJECT), and that property holds a list of FuturesLinesAssets.
  • See below:

Parent:

public class FuturesAsset
{
    public string AssetName { get; set; }
    public BindableDictionary<string, FuturesLineAsset> AssetLines { get; private set; }

    public FuturesAsset()
    {
        AssetLines = new BindableDictionary<string, FuturesLineAsset>();
    }

    public FuturesAsset(string assetName)
    {
        AssetLines = new BindableDictionary<string, FuturesLineAsset>();
        AssetName = assetName;
    }
}

Child:

public class FuturesLineAsset
{

    public string ReferenceAsset { get; set; }
    public string MID { get; set; }
    public double LivePrice { get; set; }
    public DateTime UpdateTime { get; set; }
    public DateTime LastContributedTime { get; set; }
    public double Spread { get; set; }
    public double Correlation { get; set; }
    public DateTime Maturity { get; set; }
    public double ReferenceCurve { get; set; }

    public FuturesLineAsset(string mID, string referenceAsset, double livePrice)
    {
        MID = mID;
        ReferenceAsset = referenceAsset;
        ReutersLivePrice = livePrice;
    }
}

解决方案

that exception is not related to Circular Reference, it's just purely timing out as you try to pump tons of data over the wire.

The default values that comes with WCF are very very low (these have been changed in WCF 4 I believe). Have a read on these two blog posts, they should give you an idea on how to dethrottle your service:

Creating high performance WCF services

How to throttle a Wcf service, help prevent DoS attacks, and maintain Wcf scalability

Update: also, there are a number of different timeouts in the WCF configuration and depending whether it's the client or server you're talking about you need to update a different timeout clause... have a read of this thread on what each one means and you should be able to figure out which one you need to bump up. Or, you could just set every timeout to int.max if you don't really care if a call can take a loong time to complete.

这篇关于套接字连接被中断 - 的CommunicationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆