2

Visual Studio 2010 で .NET 4 と Silverlight 4 を使用して、MSDN ガイドに従って Silverlight クライアント用の二重サービスを構築しようとしています ( http://msdn.microsoft.com/en-us/library/cc645027(v= vs.96).aspx )。

Web.config で警告が表示されます:

警告 26 要素 'bindings' に無効な子要素 'pollingDuplexHttpBinding' があります。List of possible elements expected: 'basicHttpBinding, customBinding, msmqIntegrationBinding, netPeerTcpBinding, netMsmqBinding, netNamedPipeBinding, netTcpBinding, wsFederationHttpBinding, ws2007FederationHttpBinding, wsHttpBinding, ws2007HttpBinding, wsDualHttpBinding, netTcpContextBinding, wsHttpContextBinding, basicHttpContextBinding, mexHttpBinding, mexHttpsBinding, mexNamedPipeBinding, mexTcpBinding, webHttpBinding'. C:\DuplexService\DuplexService\Web.config

サービス参照をクライアントに追加できません。WCF テスト クライアントでサービスを読み込めません。私は多くの場所で答えを探しました。問題が何であるかわかりません。

現在、web.config は次のようになっています。

<!-- Register the binding extension from the SDK. -->
<extensions>
  <bindingExtensions>
    <add name=
        "pollingDuplexHttpBinding"
        type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </bindingExtensions>
</extensions>

<bindings>
  <!-- Create the polling duplex binding. -->
  <pollingDuplexHttpBinding>
    <binding name="multipleMessagesPerPollPollingDuplexHttpBinding"
             duplexMode="MultipleMessagesPerPoll"
             maxOutputDelay="00:00:07"/>
  </pollingDuplexHttpBinding>
</bindings>

<services>
  <service name="DuplexService.OrderService"
     behaviorConfiguration="DuplexService.OrderServiceBehavior">

    <!-- Service Endpoints -->
    <endpoint
       address=""
       binding="pollingDuplexHttpBinding"
       bindingConfiguration="multipleMessagesPerPollPollingDuplexHttpBinding"
       contract="DuplexService.IDuplexService">
    </endpoint>
    <endpoint
        address="mex"
        binding="mexHttpBinding"
        contract="IMetadataExchange"/>
  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- 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>

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

4

2 に答える 2

4

私もこの問題を抱えていました。追加することでこれを解決しました

C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Server\System.ServiceModel.PollingDuplex.dll

WebRole プロジェクトのリファレンスへ。

于 2012-03-27T09:26:57.970 に答える
1

この設定を使用してください...それは私のために働きます。

<system.serviceModel>
<extensions>
  <bindingElementExtensions>
    <add name="pollingDuplex"
         type="System.ServiceModel.Configuration.PollingDuplexElement, 
         System.ServiceModel.PollingDuplex" />
  </bindingElementExtensions>
</extensions>
<bindings>
  <customBinding>
    <binding name="pollingDuplexBinding">
      <binaryMessageEncoding />
      <pollingDuplex maxPendingSessions="2147483647"   
                     maxPendingMessagesPerSession="2147483647" 
                     />
      <httpTransport />
    </binding>
  </customBinding>
</bindings>

<behaviors>
  <serviceBehaviors>
    <behavior name="sb">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
      <serviceThrottling maxConcurrentSessions="2147483647"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service name="DataServices" behaviorConfiguration="sb" >
    <endpoint address="" 
              binding="customBinding" 
              bindingConfiguration="pollingDuplexBinding"
              contract="DataServices.IDataService"/>
    <endpoint address="mex" 
              binding="mexHttpBinding" 
              contract="IMetadataExchange"/>
  </service>
</services>
于 2011-08-19T13:26:44.720 に答える