Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to enable WCF Session with wsHttpBidning with Transport only Security

I have a WCF Service currently deployed with basicHttpBindings and SSL enabled. But now i need to enable wcf sessions(not asp sessions) so i moved service to wsHttpBidnings but sessions are not enabled

I have set

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]

But when i set

SessionMode=SessionMode.Required

on service contract it says

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

following is the definition of WSHttpBinding

<wsHttpBinding>
    <binding name="wsHttpBinding">
      <readerQuotas maxStringContentLength="10240" />
      <reliableSession enabled="false" />
      <security mode="Transport">
        <transport clientCredentialType="None">
          <extendedProtectionPolicy policyEnforcement="Never" />
        </transport>
      </security>
    </binding>
  </wsHttpBinding>

please help me with this

like image 617
Mubashar Avatar asked Apr 16 '10 05:04

Mubashar


People also ask

What is the default security mode for Wshttpbinding in WCF?

Security is provided using HTTPS. The service needs to be configured with SSL certificates. The message is entirely secured using HTTPS and is authenticated by the client using the service's SSL certificate.

Which of the following are security modes supported in Wshttpbinding in WCF?

Windows Communication Foundation (WCF) security has three common security modes that are found on most predefined bindings: transport, message, and "transport with message credential." Two additional modes are specific to two bindings: the "transport-credential only" mode found on the BasicHttpBinding, and the "Both" ...

How transport security is implemented in WCF?

The transport security for this binding is Secure Sockets Layer (SSL) over HTTP, or HTTPS. To create an WCF application that uses SSL, use IIS to host the application. Alternatively, if you are creating a self-hosted application, use the HttpCfg.exe tool to bind an X. 509 certificate to a specific port on a computer.


1 Answers

If you want "sessions" with wsHttpBinding, you have to use either reliable messaging, or the security sessions.

To enable sessions on wsHttpBinding, you need reliable messaging, and for that, you need to change the setting for reliable session (the tag that looks like this <reliableSession/>) to be enabled - so your new config would look like this:

<wsHttpBinding>
    <binding name="wsHttpBinding">
      <readerQuotas maxStringContentLength="10240" />
      <reliableSession enabled="true" />
      <security mode="Transport">
        <transport clientCredentialType="None">
          <extendedProtectionPolicy policyEnforcement="Never" />
        </transport>
      </security>
    </binding>
  </wsHttpBinding>
like image 197
marc_s Avatar answered Sep 28 '22 22:09

marc_s