gpt4 book ai didi

sharepoint - 共享点站点下的 Web 服务中的 SPContext.Current 为 null

转载 作者:行者123 更新时间:2023-12-04 21:26:42 26 4
gpt4 key购买 nike

我在 SharePoint 站点中公开 Web 服务,例如http://server/_vti_bin/subdir/mywebservice.asmx .

在web服务方法中,SPContext.Current似乎为空。

(有趣的是,我正在查看 Inside Windows SharePoint Services 3.0 第 5 章中的一个示例,他们在 Web 服务中使用了 SPContext.Current!)

知道我错过了什么吗?提前致谢。

最佳答案

我看到 SPContext.Current = null 的唯一时间是在不存在的虚拟位置(即只有一半正确的 URL)调用 web 服务。

在您的问题说明中,您提到了“_vti_bin/subdir”。我还没有在 SharePoint 中托管的 WebService 中看到此 subdir 构造(免责声明:我的知识仅限于 SharePoint 中自定义 Web 服务的 2 或 3 个工作实现)

通常,你会

  • 将asmx 直接放入12 hive 的ISAPI 文件夹中。这将映射到 _vti_bin。
  • 将程序集(如果有)放入 GAC(或网站 bin 中,但我建议您使用 GAC,直到您掌握并运行基础知识)
  • 如果您确实需要,请为发现做一些事情,但是为了测试,这应该不是必需的

  • 它可能根本不相关,但我仍然会尝试先从 _vti_bin 开始工作,然后尝试弄乱子文件夹。 SharePoint 的 url 虚拟化可能很痛苦。

    关于sharepoint - 共享点站点下的 Web 服务中的 SPContext.Current 为 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2283513/

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