[英]How to use .NET Core 3.x with Azure Function App Powershell Runtime?
I have created a new Function App using the below resource in my template:我使用模板中的以下资源创建了一个新的 Function 应用程序:
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/sites",
"name": "[parameters('caAppName')]",
"location": "[parameters('location')]",
"kind": "functionapp",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
],
"identity": {
"type": "SystemAssigned"
},
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
"siteConfig": {
"appSettings": [
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[toLower(parameters('caAppName'))]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~3"
},
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~10"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(resourceId('microsoft.insights/components/', variables('applicationInsightsName')), '2015-05-01').InstrumentationKey]"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "powershell"
},
]
}
}
I run the below code in the function app in the portal Write-Host "$([System.Security.Cryptography.X509Certificates.X509Certificate2].Assembly.Location)"
我在门户Write-Host "$([System.Security.Cryptography.X509Certificates.X509Certificate2].Assembly.Location)"
的 function 应用程序中运行以下代码
I get D:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.8\System.Security.Cryptography.X509Certificates.dll我得到 D:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.8\System.Security.Cryptography.X509Certificates.dll
But if I use the Function App console:但如果我使用 Function App 控制台:
D:\Program Files\dotnet\shared\Microsoft.NETCore.App> ls
2.2.8
2.2.8.installed
3.0.3
3.0.3.installed
3.1.3
3.1.3.installed
So 3.1.3 is present, but the function is not executing with it.所以 3.1.3 存在,但 function 没有与它一起执行。
I only even noticed because I tried to use System.Security.Cryptography.PbeParameters and the type is missing (along with some other AsymmetricAlgorithm stuff)我什至只注意到,因为我尝试使用 System.Security.Cryptography.PbeParameters 并且缺少类型(以及其他一些 AsymmetricAlgorithm 的东西)
How do I resolve this?我该如何解决这个问题?
The .NET Core version is determined by the Azure PowerShell worker, which depends on the PowerShell SDK. The .NET Core version is determined by the Azure PowerShell worker, which depends on the PowerShell SDK. PowerShell 6 is the only version currently available in Azure Functions, and it depends on .NET Core 2.x, this is why your PowerShell Function is executed in this context. PowerShell 6 is the only version currently available in Azure Functions, and it depends on .NET Core 2.x, this is why your PowerShell Function is executed in this context. In order to use .NET Core 3.x, you have the following options:为了使用 .NET Core 3.x,您有以下选项:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.