Azure 在计时器函数应用程序中执行CSOM代码时出现400错误请求
我无法将CSOM代码作为Azure函数计时器作业执行,并且在执行execute query语句后收到400个错误请求错误。代码作为控制台应用程序执行,没有任何错误 在这里,我不是通过VisualStudio创建和部署应用程序。我直接在文件run.csx的timer函数中执行Azure本身的代码,在这里我不传递访问令牌,通过传递硬编码用户名和securestring密码并面对问题,使用SharePoint online credentials语句执行正常身份验证 堆栈跟踪Azure 在计时器函数应用程序中执行CSOM代码时出现400错误请求,azure,sharepoint,Azure,Sharepoint,我无法将CSOM代码作为Azure函数计时器作业执行,并且在执行execute query语句后收到400个错误请求错误。代码作为控制台应用程序执行,没有任何错误 在这里,我不是通过VisualStudio创建和部署应用程序。我直接在文件run.csx的timer函数中执行Azure本身的代码,在这里我不传递访问令牌,通过传递硬编码用户名和securestring密码并面对问题,使用SharePoint online credentials语句执行正常身份验证 堆栈跟踪 2018-10-08T2
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)
创建函数应用程序时,运行时版本默认设置为~2。这是不应该使用的。应该是V1
Runtime version: 1.0.11959.0 (~1)
这纠正了问题。可能的修复方法:将Azure Function Version Runtime设置为v2tanks以回复@Hackerman。它已经在使用运行时V2。运行时版本:2.0.12115.0(~2)