【发布时间】:2014-03-14 11:13:05
【问题描述】:
我在 wcf 项目中使用以下示例函数。它在内部工作正常。当我从托管服务外部调用此函数时。它返回错误。
Object reference not set to be an instance of an object.
我找到那行 HttpContext.Current.Session["UserSession"] // 错误代码
try
{
if (HttpContext.Current.Session["UserSession"] != null)
{
}
else
{
}
}
catch(Exception ex)
{
return ex.Message;
}
但我想使用会话变量。请帮我解决这个问题。
【问题讨论】:
-
eles?不会是else?请阅读stackoverflow.com/questions/4660142/… -
检查stackoverflow.com/questions/8321269/how-to-use-session-in-wcf让我们看看你的服务和web.config
-
@KamranShahid 非常感谢。链接工作正常。
标签: c# asp.net web-services wcf c#-4.0