在binding中設定好ReliableSession.enabled = True即可
另外在Contract中,可以設定SessionMode=SessionMode.Requied
[ServiceContract(Name = "IWGWCF", SessionMode = SessionMode.Required)]
public interface IWGWCF
{
[OperationContract]
string search(string keyword, int start, int returnCount);
}
在behavior中可以設定session使用的時間周期
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class WGWCF : IWGWCF
{
public string search(){
}
}
No comments:
Post a Comment