我一直在根据需要使用 webHttpBinding session 模式开发 WCF REST 服务。但我总是收到此错误“契约(Contract)需要 session ,但绑定(bind)‘WebHttpBinding’不支持它或未正确配置为支持它。”任何人都可以说出这是什么原因吗?
最佳答案
引自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?
关于c# - 我们如何为 WebHttpBinding WCF REST 服务实现 session 管理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21257565/