从托管的azure云服务中检索数据

时间:2014-10-02 13:07:07

标签: c# web-services wcf azure

我正在尝试从我托管的在线azure云服务中检索记录,但是当我尝试检索大量记录时,我收到此错误。但是,当我用一个记录测试它时,我没有得到任何错误。

这是我得到的错误: mscorlib.dll中发生未处理的“System.ServiceModel.CommunicationException”类型异常

其他信息:服务器未提供有意义的回复;这可能是由于合同不匹配,过早的会话关闭或内部服务器错误造成的。

这是我的代码:

static void Main(string[] args)
{
    ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();

    client.Open();

    ServiceReference1.TrackList List = new ServiceReference1.TrackList();
    List = client.SearchTrackByAuthComp(10000015);

    foreach (var item in List.Trax)
    {
        Console.WriteLine(item.Title);
    }

    //Console.WriteLine(hold);
    Console.ReadKey();

    client.Close();


}

public static TrackList SearchTrackByAuthComp(int intAuthCompID)
{
    SamroEntitiesV2 Context = new SamroEntitiesV2();
    TrackList Traks = new TrackList();

    try
    {
        Traks.Trax = Context.Tracks.Where(x => x.CompAuthID.Equals(intAuthCompID)).ToList();
        Traks.OperationStatus.Status = true;
    }
    catch (Exception)
    {
        Traks.OperationStatus.Status = false;
    }
    return Traks;
}
public class TrackList : BaseEntity
{
    public List<Tracks> Trax { get; set; }

    public TrackList()
    {
        if (Trax == null)
            Trax = new List<Tracks>();
    }
}

public class OperationStatus
{
    public bool Status { set; get; }
}

public class BaseEntity
{
    public OperationStatus OperationStatus { set; get; }

    public BaseEntity()
    {
        if (OperationStatus == null)
        OperationStatus = new OperationStatus();
    }
}

0 个答案:

没有答案