1

我正在尝试在我的 WCF 服务 (webHttp) 中使用会话,但请求之间的会话不一致(当我第二次调用服务时会话不是 NULL,但我插入的密钥不存在并且会话身份证不同)。

我检查了默认的 InstanceContextMode 是 PerSession,据我了解,这应该适合我的要求。

在 WCF 中使用会话是否需要任何其他配置?

谢谢!

4

1 回答 1

3

You need to use a binding that supports reliable sessions, such as these:

  • HTTP-based transport standard bindings:

    WsHttpBinding and expose request-reply or one-way contracts.

    Can be used when using reliable session over a request-reply or simple one-way service contract.

    WsDualHttpBinding and expose duplex, request-reply, or one-way contracts.

    WsFederationHttpBinding and expose request-reply or one-way contracts.

  • TCP-based transport standard bindings:

    NetTcpBinding and expose duplex, request reply, or one-way contracts.

Look here for more info: http://msdn.microsoft.com/en-us/library/ms733136.aspx

于 2012-08-02T13:28:43.850 回答