wcf中使用Session
1.标记WCF服务开启Session模式
[ServiceContract(SessionMode = SessionMode.Required)]
2.服务类添加ASPNETSESSION兼容标记
[System.ServiceModel.Activation.AspNetCompatibilityRequirements(RequirementsMode = System.ServiceModel.Activation.AspNetCompatibilityRequirementsMode.Required)]
3.配置WEB.CONFIG文件中<system.serviceModel>节
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"></serviceHostingEnvironment>