下载一个网站的源码下载,品牌公司标志设计制作,2017网站建设有市场吗,wordpress编辑模板在WCF中不能使用HttpSession#xff0c;即使Host是IIS也不可以#xff0c;这就造成在WEB应用中集成WCF不太方便#xff0c;其实可以通过配置搞定#xff0c;关键在于三点#xff1a;Host、契约类、Client端。 Host上要求Web.config中有定义#xff1a; system.servic… 在WCF中不能使用HttpSession即使Host是IIS也不可以这就造成在WEB应用中集成WCF不太方便其实可以通过配置搞定关键在于三点Host、契约类、Client端。 Host上要求Web.config中有定义 system.serviceModel serviceHostingEnvironment aspNetCompatibilityEnabledtrue/ /system.serviceModel 契约实现类上要有Attribute指明允许使用session要设在实现类上而不是契约接口上 [AspNetCompatibilityRequirements(RequirementsMode AspNetCompatibilityRequirementsMode.Required)]publicic class Hello : IHello { //...... } Client端配置文件中定义binding时要允许使用cookie设置allowCookiestrue system.serviceModel binding nameWSHttpBinding_IHello allowCookiestrue / /system.serviceModel 这样就可以放心使用 HttpContext.Current.Session 了。 转载于:https://blog.51cto.com/boytnt/791577