1

私はこれを理解するのにかなりの時間を費やしています。Silverlightクライアントに情報を提供する必要があるWCFサービスがありますが、これに参加できるようにするにはコンソールアプリケーションも必要です。コンソールアプリがアクセスできる追加のバインディングを指定するために、Web.Configがどのように表示されるかについてのヒントを誰かに教えてもらえますか?動作していると思うと、SLクライアントはメッセージを受信できません...

これが私の現在のWeb.Configです。

<?xml version="1.0"?>

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

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

    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <!-- Create the polling duplex binding. -->
    <bindings>
      <pollingDuplex>
        <binding name="myPollingDuplex"
                 duplexMode="MultipleMessagesPerPoll">
        </binding>
      </pollingDuplex>
    </bindings>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
      <service name ="EdiManager.Web.EdiPubSub">
        <endpoint address=""
                  binding="pollingDuplex"
                  bindingConfiguration="myPollingDuplex"
                  contract="EdiManager.Web.EdiPubSub"
                  />
        <endpoint address="mex" 
                  binding="mexHttpBinding"
                  contract="IMetadataExchange" >
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
      </service>
    </services>
    </system.serviceModel>
</configuration>
4

3 に答える 3

1

コンソールアプリケーションもポーリングデュプレックス接続に参加しますか?または、別のクエリ応答バインディングを使用しますか?

また、ポーリングデュプレックスでAspNetCompatibilityを使用していることに気付きました。セッション状態にアクセスしている場合は、パフォーマンスの問題が発生します。テスト情報を含むMSDNブログ投稿を参照する短いブログ投稿を行いました。

つまり、ポーリングデュプレックスは長時間の操作です。セッション状態はロックされ、ポーリングがタイムアウトして、セッション状態プロバイダーを再度ロックする別の接続が確立されるまで、他の要求を続行できません。

于 2010-11-06T04:34:50.500 に答える
1

全二重が必要ない場合は、mexの代わりにwsHttpBindingを使用してください(または、達成したいことの詳細を提供してください)。

于 2010-11-05T22:10:55.037 に答える
0

手作業ではなく、WCFサービスエディターを使用して構成を編集することで、機能させることができました。明らかに、設定を手動で編集する際に間違いを犯していました。動作するweb.configは次のとおりです。

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

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

    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <!-- Create the polling duplex binding. -->
    <bindings>
      <wsDualHttpBinding>
        <binding name="myDualHttp" />
      </wsDualHttpBinding>
      <pollingDuplex>
        <binding name="myPollingDuplex" duplexMode="MultipleMessagesPerPoll" />
      </pollingDuplex>
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
      <service name="EdiManager.Web.EdiPubSub">
        <endpoint address="Silverlight" binding="pollingDuplex" bindingConfiguration="myPollingDuplex"
          name="Silverlight" contract="EdiManager.Web.EdiPubSub" />
        <endpoint address="Console" binding="wsDualHttpBinding" bindingConfiguration="myDualHttp"
          name="Console" contract="EdiManager.Web.EdiPubSub" />
      </service>
    </services>
    </system.serviceModel>
</configuration>
于 2010-11-08T13:56:25.480 に答える