6

wsHTTPBinding を使用して WCF サービスを構成しましたが、それでもエラーが発生します

Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it.

ここにサービス契約の定義があります

<ServiceContract(SessionMode:=SessionMode.Required)>
Public Interface IPrivateService

これがサービス実装定義です

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
Public Class PrivateService
    Implements IPrivateService

コンフィグ設定はこちら

<services>
    <service behaviorConfiguration="behaviorAction" name="Viking.Service.PrivateService">
            <endpoint address="RequiredService" binding="wsHttpBinding" bindingConfiguration="bindingAction" contract="Viking.Service.IPrivateService">
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
</services>
<bindings>
          <wsHttpBinding>
            <binding name="bindingAction" transactionFlow="false" sendTimeout="00:30:00" receiveTimeout="00:30:00">
              <reliableSession enabled="true"/>
            </binding>
          </wsHttpBinding>
</bindings>

この問題に関するアドバイスを本当に感謝します。

4

1 に答える 1

24

wcf 4.0 を使用している場合は、web.config/app.config を開き、タグ内に次のタグを追加します<system.serviceModel>

  <protocolMapping>
  <add scheme="http" binding="wsHttpBinding"/>
</protocolMapping>
于 2011-02-08T07:20:48.467 に答える