Silverlight 4 WCF服务器未提供有意义的答复
我得到了一个臭名昭著的结论,“服务器没有提供有意义的回复;这可能是由于我的项目中的契约不匹配、会话过早关闭或内部服务器错误造成的”。这是一个WCF PollingDuplex服务,由Silverlight 4项目使用 我正在使用该服务请求一个文档,以便可以在SL应用程序的查看器中显示它 以下是服务器Web配置XML:Silverlight 4 WCF服务器未提供有意义的答复,wcf,silverlight-4.0,internal-server-error,Wcf,Silverlight 4.0,Internal Server Error,我得到了一个臭名昭著的结论,“服务器没有提供有意义的回复;这可能是由于我的项目中的契约不匹配、会话过早关闭或内部服务器错误造成的”。这是一个WCF PollingDuplex服务,由Silverlight 4项目使用 我正在使用该服务请求一个文档,以便可以在SL应用程序的查看器中显示它 以下是服务器Web配置XML: <system.serviceModel> <extensions> <bindingExtensions>
<system.serviceModel>
<extensions>
<bindingExtensions>
<add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</bindingExtensions>
</extensions>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="PortalOnlineBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<pollingDuplex>
<binding name="SLPollingDuplex" duplexMode="MultipleMessagesPerPoll" />
</pollingDuplex>
</bindings>
<services>
<service name="Online.Web.PortalOnline" behaviorConfiguration="PortalOnlineBehavior">
<endpoint address="" binding="pollingDuplex" bindingConfiguration="SLPollingDuplex"
contract="Notification.IPortalOnline" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://portalonline.com/PortalOnline/IPortalOnline" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
进一步详情:
这对于一个或两个文档请求来说非常有效,并且给出了上面提到的错误。例如,我可以在使用此服务的此方法加载SL应用程序时加载默认文档,并且它可以完美地填充。然后我可以转到我拥有的树状视图,选择一个文档,它对第一个文档非常有效。。。但在那之后,错误就来了。此外,我注意到有时它只工作一次,如果我选择某些稍大一点的PDF(250kb左右…)。。。哦,我忘了。。。下面是我的SL应用程序中连接到WCF服务的代码。我使用的是“GetBaseWebAddress()”,因为我使用的是动态子域,所以每次部分地址都可能不同
Private Sub LoadClient()
Dim bind As New PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll)
Dim endpoint As New EndpointAddress(GetBaseWebAddress() & "PortalOnline/PortalOnline.svc")
Me.client = New PortalOnline.PortalOnlineClient(bind, endpoint)
AddHandlers()
End Sub
我已经为此挣扎了一段时间,因此非常感谢您的帮助……您找到了任何解决方案吗?为了获取文件流,我最终恢复到一个老式的asmx web服务来进行此特定调用,其余的web服务调用都起到了作用。我记得我抓取了那个代理类,它是在我完成了对服务的任何“破坏性”更改之后创建的,只是将它作为资源之外的一个常规类,然后在代理周围使用部分类工具。然后,我从项目中删除了服务引用,只使用了我创建的代理类,所有这些都很好地工作。
Public Function GetDocument(sessionUserMeta As Common.UserMetaData, docId As System.Guid) As Notification.PortalDocument Implements Notification.IPortalOnline.GetDocument
Dim doc As Documents.Document = Documents.Document.GetDocument(docId, sessionUserMeta)
Dim portalDoc As New PortalDocument
portalDoc.DataSource = doc.DataSource
portalDoc.FileName = doc.QueryPackage.DocumentName
portalDoc.FileType = doc.QueryPackage.Type
Return portalDoc
End Function
Private Sub LoadClient()
Dim bind As New PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll)
Dim endpoint As New EndpointAddress(GetBaseWebAddress() & "PortalOnline/PortalOnline.svc")
Me.client = New PortalOnline.PortalOnlineClient(bind, endpoint)
AddHandlers()
End Sub