开发者

silverlight datagrid not showing data

I have silverlight application with a WCF service to access a table in sql server DB. I copied all the code from the tutorial and running it from my desktop. It failes to load the sql server data although everything else loads fine. Other posts talk about the http://localhost:PortNumber/Service1.svc being the problem and I should deploy the servive while others talk about using an observable collection instead. Does anyone have an explanation on what the issue could be and how to correct it.

Imports System.ServiceModel
Imports System.ServiceModel.Activation

Public Class Service1

<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()>

End Class

servicerefernces..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>


Break down the problem into smaller chunks.

  • Eliminate WCF from the equation to verify that your Silverlight databinding is working correctly. You can do this by simply binding to a premade list.
  • The WcfTestClient allows you to isolate and test your web service independent of Silverlight.
  • When troubleshooting Silverlight and WCF together, fiddler is a must so that you can see your applications service call and the response.

Hopefully this is enough to solve or lead you to a more specific problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜