HTTPContext 在我的 WCF 调用中始终为 null,它是否已过时或者我做错了什么?
最佳答案
常规 HTTPContext 不再与 WCF 一起使用。您需要实例上下文。
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class MyService : IMyService
{
InstanceContext ic = OperationContext.Current.InstanceContext;
}
请参阅此链接了解更多详细信息
http://www.danrigsby.com/blog/index.php/2008/05/23/understanding-instancecontext-in-wcf/
您还可以启用compatibility mode因此您的 WCF 服务就像旧的 Web 服务一样,但您最好使用 InstanceContext
关于wcf - HTTPContext 在 WCF 中是否已过时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1519809/