Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
silverlight datagrid不显示数据_Silverlight_Visual Studio 2010 - Fatal编程技术网

silverlight datagrid不显示数据

silverlight datagrid不显示数据,silverlight,visual-studio-2010,Silverlight,Visual Studio 2010,我有一个带有WCF服务的silverlight应用程序来访问sql server DB中的表。我复制了教程中的所有代码,并从桌面上运行它。它无法加载sql server数据,尽管其他一切都可以正常加载。 其他帖子谈到问题所在,我应该部署服务,而其他帖子则谈到使用可观察的集合。是否有人解释了问题可能是什么以及如何纠正 Imports System.ServiceModel Imports System.ServiceModel.Activation 公共类服务1 <OperationCo

我有一个带有WCF服务的silverlight应用程序来访问sql server DB中的表。我复制了教程中的所有代码,并从桌面上运行它。它无法加载sql server数据,尽管其他一切都可以正常加载。 其他帖子谈到问题所在,我应该部署服务,而其他帖子则谈到使用可观察的集合。是否有人解释了问题可能是什么以及如何纠正

Imports System.ServiceModel
Imports System.ServiceModel.Activation
公共类服务1

<OperationContract()>
Public Function GetPostCounts() As List(Of RealTimePostCount)
    ' Add your operation implementation here
    Dim db As New DataClasses1DataContext

    Dim posts = (From record In db.RealTimePostCounts Order By record.boxCount, record.boxFeed, record.pollDate Select record)
    Dim list As New List(Of RealTimePostCount)
    For Each p In posts
        list.Add(New RealTimePostCount With {.boxCount = p.boxCount, .boxFeed = p.boxFeed, .pollDate = p.pollDate})
    Next

    Return list


End Function

' Add more operations here and mark them with <OperationContract()>

公共函数GetPostCounts()作为列表(RealTimePostCount)
'在此处添加您的操作实现
Dim db作为新的DataClasses1DataContext
Dim posts=(根据record.boxCount、record.boxFeed、record.pollDate选择记录从db.RealTimePostCounts中的记录排序)
Dim列表作为新列表(RealTimePostCount)
每p个员额
添加(带有{.boxCount=p.boxCount、.boxFeed=p.boxFeed、.pollDate=p.pollDate}的新RealTimePostCount)
下一个
返回列表
端函数
'在此处添加更多操作,并用
末级

ServiceReferences..clientconfig

<configuration>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_Service1" maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647">
                <security mode="None" />
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:12018/Service1.svc" binding="basicHttpBinding"
            bindingConfiguration="BasicHttpBinding_Service1" contract="ServiceReference1.Service1"
            name="BasicHttpBinding_Service1" />
    </client>
</system.serviceModel>


将问题分解成小块

  • 从等式中删除WCF,以验证Silverlight数据绑定是否正常工作。您可以通过简单地绑定到预先制作的列表来实现这一点
  • 允许您独立于Silverlight隔离和测试web服务
  • 在一起对Silverlight和WCF进行故障排除时,必须这样才能看到应用程序服务调用和响应

希望这足以解决或导致您遇到更具体的问题。

testclient出现以下错误:调用服务失败。可能原因:服务离线或无法访问;客户端配置与代理不匹配;现有代理无效。有关更多详细信息,请参阅堆栈跟踪。您可以通过启动新代理、还原到默认配置或刷新服务来尝试恢复。现在您遇到了更详细的错误。试着从这里开始