从 Azure 数据工厂 (ADF) 调用 Azure 函数时出现异常
Exception while calling Azure Function from Azure Data Factory (ADF)
我已经设置了 2.0 版的 Azure Powershell 函数。从 Azure 数据工厂 (ADF) 执行函数时出现以下异常。
"errorCode": "2011",
"message": "Could not load file or assembly 'CodeGenerator, Version=1.1.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXX' or one of its dependencies. The system cannot find the file specified.",
"failureType": "UserError",
"target": "Azure Function1"
函数应用代码
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
$name = $Request.Query.Name
if (-not $name) {
$name = $Request.Body.Name
}
if ($name) {
$status = [HttpStatusCode]::OK
$body = "Hello $name"
}
else {
$status = [HttpStatusCode]::BadRequest
$body = "Please pass a name on the query string or in the request body."
}
# Associate values to output bindings by calling 'Push-OutputBinding'.
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = $status
Body = $body
})
我是 Azure Functions 的初学者。请帮忙
此问题已解决,复制OP的评论,对其他有类似问题的人有帮助:
This issue was with integration runtime. I changed the runtime from
self hosted to auto resolved and its working fine.
我已经设置了 2.0 版的 Azure Powershell 函数。从 Azure 数据工厂 (ADF) 执行函数时出现以下异常。
"errorCode": "2011",
"message": "Could not load file or assembly 'CodeGenerator, Version=1.1.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXX' or one of its dependencies. The system cannot find the file specified.",
"failureType": "UserError",
"target": "Azure Function1"
函数应用代码
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
$name = $Request.Query.Name
if (-not $name) {
$name = $Request.Body.Name
}
if ($name) {
$status = [HttpStatusCode]::OK
$body = "Hello $name"
}
else {
$status = [HttpStatusCode]::BadRequest
$body = "Please pass a name on the query string or in the request body."
}
# Associate values to output bindings by calling 'Push-OutputBinding'.
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = $status
Body = $body
})
我是 Azure Functions 的初学者。请帮忙
此问题已解决,复制OP的评论,对其他有类似问题的人有帮助:
This issue was with integration runtime. I changed the runtime from self hosted to auto resolved and its working fine.