繁体   English   中英

silverlight 数据网格未显示数据

[英]silverlight datagrid not showing data

我有 silverlight 应用程序和 WCF 服务来访问 sql 服务器数据库中的表。 我从教程中复制了所有代码并从我的桌面运行它。 它无法加载 sql 服务器数据,尽管其他一切都加载正常。 其他帖子谈论http://localhost:PortNumber/Service1.svc是问题所在,我应该部署服务,而其他帖子则谈论使用可观察集合。 有没有人解释问题可能是什么以及如何纠正它。

Imports System.ServiceModel
Imports System.ServiceModel.Activation

公共 Class 服务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()>

结束 Class

服务引用..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 数据绑定是否正常工作。 您可以通过简单地绑定到预制列表来做到这一点。
  • WcfTestClient允许您独立于 Silverlight 隔离和测试 web 服务。
  • 当一起对 Silverlight 和 WCF 进行故障排除时, fiddler是必须的,这样您就可以看到您的应用程序服务调用和响应。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM