簡體   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