WCF Windows服务和Windows应用商店应用程序无意义的回复错误消息

时间:2013-03-03 03:29:34

标签: wcf windows-store-apps

我在使用Windows 8编程时遇到很多问题。

一个问题是,我无法安装IIS,因为Windows 8给我带来了问题,因为我使用7进行双重启动。任何操作系统更新都会失败,包括配置更改,例如添加IIS。

但无论如何,为了解决这个问题,我决定在具有TCP端点的Windows服务中托管WCF服务,并在我的Store应用程序中使用该服务。对于插入,它可以工作,而不是问题。

但是当我去检索一些数据(一个非常小的数据集--3条记录)时,会显示以下错误:服务器没有提供有意义的回复;这可能是由合同不匹配,过早的会话关闭或内部服务器错误引起的。

我用Google搜索了这个错误,它似乎是一个常见的错误 - 意味着它可能是任何东西。但我是WCF的总菜鸟。

我在ViewModel中的代码很简单:

    private async void PopulatePeople()
    {
        var people = await licenceBucketService.GetAllPersonsAsync();

        FirstName = people.First().FirstName;
        LastName = people.First().LastName;
    }

GetAllPersons方法是:

public ObservableCollection<Person> GetAllPersons()
{
    ObservableCollection<Person> people = null;

    using (var context = new LicenceBucketContext())
    {
         people = new ObservableCollection<Person>(context.People);
    }

    return people;
}

Reference.cs文件中的异步版本如下所示:

public System.Threading.Tasks.Task<System.Collections.ObjectModel.ObservableCollection<Win8UI.LicenceBucketService.Person>> GetAllPersonsAsync() {
        return base.Channel.GetAllPersonsAsync();
    } 

任何WCF专家都会看到我的问题吗?

0 个答案:

没有答案