虽然很多人说不建议启用,但我就是想启用。
[ServiceContract(SessionMode=SessionMode.Allowed)]
public interface IBIService
{ } [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class BIService:IBIService
{ }
如果接口上启用了session,实现类必须指定session模式,否则可能导致服务被调用一次后,一直报跨域错误。