[英]HttpContext.Current.User is null after installing .NET Framework 4.5
I was using .NET 4.0 VS10. 我使用的是.NET 4.0 VS10。 I had working WCF services that were using forms authentication.
我有使用表单身份验证的WCF服务。 I upgraded to VS11, .NET 4.5.
我升级到VS11,.NET 4.5。
Now my HttpContext.Current.User is null, in a wcf request. 现在我的HttpContext.Current.User在wcf请求中为null。 I injected a cookie from login to this request.
我从登录中注入了一个cookie给这个请求。
HttpRequestMessageProperty httpRequest;
...
httpRequest.Headers.Add(HttpRequestHeader.Cookie, cookie);
Any ideas how to make it work again? 任何想法如何让它再次工作?
Already have the 已经有了
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
and the 和
[AspNetCompatibilityRequirements(RequirementsMode = spNetCompatibilityRequirementsMode.Required)]
If you are running into this issue in an Oneway (operations marked with [OperationContract(IsOneWay=true)] ) WCF operation contract, here is the reason for the issue. 如果您在Oneway中遇到此问题(标记为[OperationContract(IsOneWay = true)]的操作)WCF操作合同,这就是问题的原因。 HttpContext is an asp.net construct.
HttpContext是一个asp.net构造。 After a one way operation is successfully invoked the service model sends back a 202 (Accepted) reply back to the client.
在成功调用单向操作之后,服务模型将202(已接受)回复发送回客户端。
Since we found a few customer reports on this, a quirked fix is made in .net 4.5.1 update. 由于我们在此发现了一些客户报告,因此在.net 4.5.1更新中进行了一个怪异的修复。 To give more details about the fix:
要提供有关修复的更多详细信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.