【问题标题】:Getting 400 bad request error while executing CSOM code in timer function app在计时器功能应用程序中执行 CSOM 代码时出现 400 错误请求错误
【发布时间】:2018-10-08 21:03:02
【问题描述】:

我无法将 CSOM 代码作为 Azure 函数计时器作业执行,并且在执行 Execute query 语句后出现 400 bad request 错误。该代码作为控制台应用程序执行,没有任何错误

这里我不是通过 Visual Studio 创建和部署应用程序。我在文件 run.csx 中的计时器函数中直接执行 Azure 本身中的代码,这里我通过传递硬编码的用户名和安全字符串密码并面临问题,在不传递访问令牌和使用 SharePoint 在线凭据语句的情况下进行正常身份验证。

堆栈跟踪

2018-10-08T20:56:17  Welcome, you are now connected to log-streaming service.
2018-10-08T20:56:38.007 [Information] Executing 'Functions.ExpiredSLAIdentifier' (Reason='This function was programmatically called via the host APIs.', Id=36f36c56-ac48-4220-bcc4-040658d77fa2)
2018-10-08T20:56:42.685 [Information] Azure Function Exception:    at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
   at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate()
   at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest()
   at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
   at Submission#0.Run(TimerInfo myTimer, ILogger log) in D:\home\site\wwwroot\ExpiredSLAIdentifier\run.csx:line 25
2018-10-08T20:56:42.702 [Information] Executed 'Functions.ExpiredSLAIdentifier' (Succeeded, Id=36f36c56-ac48-4220-bcc4-040658d77fa2)

【问题讨论】:

  • 可能的修复:将 Azure 函数版本运行时设置为 V2
  • 感谢您回复@Hackerman。它已经在使用运行时 V2。运行时版本:2.0.12115.0 (~2)

标签: azure sharepoint


【解决方案1】:

在创建函数应用程序时,运行时版本默认设置为 ~2。那不应该被使用。应该是V1。

Runtime version: 1.0.11959.0 (~1)

这解决了问题。

【讨论】:

    猜你喜欢
    • 2021-01-28
    • 2020-07-05
    • 1970-01-01
    • 2016-08-25
    • 1970-01-01
    • 1970-01-01
    • 2016-12-08
    • 2013-09-27
    • 2015-08-18
    相关资源
    最近更新 更多