セッションを使用する.NETWebサービス:[WebMethod(EnableSession = true)]



Net Webservice Using Session



現象:今日はバグに遭遇し、変数のopenidを少なくします

理由:



  1. openidは、セッションでマイクロチャネルサービスを通過します
  2. 次に、SessionでWebServiceを使用します。変数を取得しますが、EnableSessionは設定しません。

WebMethodのデフォルトのEnableSession = false

解決:[WebMethod( EnableSession = true )]



[WebMethod(EnableSession = true)] [ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)] public string Binding() { return Session['openid'].ToString() }

複製:https://my.oschina.net/yanjiez/blog/2967552