1

私のプロジェクトで、「サーバーは意味のある応答を提供しませんでした。これは、契約の不一致、セッションの早期シャットダウン、または内部サーバー エラーが原因である可能性があります」という悪名高いものを取得しています。これは、Silverlight 4 プロジェクトによって使用される WCF PollingDuplex サービスです。

サービスでドキュメントをリクエストしているので、SL アプリケーションのビューアーで表示できます。

サーバー Web 構成 XML は次のとおりです。

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

これは、この WCF サービスを介して SL に返そうとするオブジェクトです。

Imports System.ServiceModel
Imports System.Runtime.Serialization
Imports DocCave.Common
Imports System.Xml
Imports System.IO

    <DataContract(NAMESPACE:=DataStore.NAMESPACE)>
    Public Class PortalDocument

        <DataMember()>
        Public Property DataSource As Byte()

        <DataMember()>
        Public Property FileName As String

        <DataMember()>
        Public Property FileType As String

    End Class

呼び出されている WCF メソッドは次のとおりです。

 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

詳細:

これは、1 つまたは 2 つのドキュメント要求に対して完全に機能し、上記のエラーが表示されます。たとえば、このサービスでこのメソッドを使用して SL アプリケーションが読み込まれると、デフォルトのドキュメントを読み込むことができ、完全に読み込まれます。次に、持っているツリー ビューに移動してドキュメントを選択すると、最初のドキュメントでは完璧に機能しますが、その後エラーが発生します。また、少し大きい (250kb 程度) 特定の pdf を選択すると、一度しか機能しない場合があることに気付きました...ああ、忘れていました... 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

私はしばらくこれに苦労していたので、どんな助けでも大歓迎です...

4

0 に答える 0