WCF 應用 讀取 寫入 Session
最近整合同事一隻WCF的程式~在整合的過程中一直發生SESSION無法寫入或讀取的問題,到最後才發現到原來WCF中如果要用SESSION必須設定一些參數才能使用。 web.config <configuration> .... <system.serviceModel> .... <serviceHostingEnvironment aspNetCompatibilityEnabled =" true " multipleSiteBindingsEnabled="true" /> </system.serviceModel> </configuration> [File].svc.cs namespace WCF.Test { [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class Main : Main { public void getSession() { System.Web.HttpContext.Current.Session["NAME"]; } } }