How can we implement Session management for WebHttpBinding WCF REST Service?

前端 未结 1 786
面向向阳花
面向向阳花 2021-01-15 03:37

I have been developing a WCF REST service using webHttpBinding Session mode as required.But I am getting this error always \"Contract requires Session, but Binding \

相关标签:
1条回答
  • 2021-01-15 03:56

    Quote from the MSDN forums:

    You cannot use WebHttpBinding for session based communication as it doesn't support the concept of sessions. I talked at length about sessions here - http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,af6e6325-2e30-42e3-acb9-57e1363fa51e.aspx.

    WebHttpBinding doesn't support session for the same reason BasicHttpBinding doesn't. If you really must have sessions then you will have to use a binding that supports it. However, PerSession activation is only one way to maintain per client state. Can you not use another mechanism, say passing a session id to the service that you use to wire up your own concept of session?

    0 讨论(0)
提交回复
热议问题