gpt4 book ai didi

asp.net - 在 wcf 服务中使用 aspNetCompatibilityEnabled ="false"获取 HttpContext.Current

转载 作者:行者123 更新时间:2023-12-01 06:22:42 24 4
gpt4 key购买 nike

我的网站完全是 HTTPS。所以我想在 HTTPS 协议(protocol)中调用 WCFService 但微软说 aspNetCompatibilityEnabled="true"我们不能使用非 http 绑定(bind),这可能就是我收到 ServiceActionException 的原因。
当我制作 aspNetCompatibilityEnabled="false" WCF 服务在 HTTPS 上运行良好。但是 HttpContext.Current 的值是 .

那么如何通过 HTTPS 绑定(bind)获取 HttpContext.Current 值?

我正在关注这个 link

有人可以帮忙吗?

最佳答案

要使 HttpContext.Current 成为非空值,您必须将 aspNetCompatibility 设置为 true 或允许。您可以通过 WebOperationContext.Current.IncomingRequest.Headers 访问消息头。

关于asp.net - 在 wcf 服务中使用 aspNetCompatibilityEnabled ="false"获取 HttpContext.Current,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31785141/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com