我有一个带有WCF服务的silverlight应用程序来访问sql server DB中的表。我复制了教程中的所有代码并从我的桌面运行它。尽管其他所有内容都可以正常加载,但它很难加载sql server数据。 其他帖子谈论http://localhost:PortNumber/Service1.svc是问题,我应该部署servive,而其他人谈论使用可观察的集合。有没有人解释问题是什么以及如何纠正它。
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()>
结束班
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>
答案 0 :(得分:1)
将问题分解为更小的块。
希望这足以解决或引导您解决更具体的问题。