简体   繁体   English

如何使用 .NET Core 3.x 与 Azure Function 应用程序 Z531B84AD41B2A7501DA83ACF367 运行时?

[英]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,您有以下选项:

  • recommended: wait for PowerShell 7 support in Azure Functions (expected to be deployed within the next 2-4 weeks);推荐:等待 Azure 功能中的 PowerShell 7 支持(预计在未来 2-4 周内部署);
  • spawn a separate executable from your PowerShell function.从您的 PowerShell function 生成一个单独的可执行文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 C# 为运行时版本 3.x 禁用 Azure Function? - Disable Azure Function from C# for runtime version 3.x? Azure 应用服务 - 更新 .NET Core 运行时 - Azure App Service - update .NET Core runtime 如何将.net Core应用发布到Azure应用服务以在Function中使用? - How do I publish a .net Core app to Azure App Service for use in a Function? 如何将 Azure 功能从 .netcore 3.x 更新到 .net 5.0 - How to update Azure functions from .netcore 3.x to .net 5.0 如何在 Azure Function 应用程序中使用 System.Runtime.Caching - How to use System.Runtime.Caching in an Azure Function App 如何从 .NET Core API 调用 Azure 门户中的函数应用程序 - How to call function App in Azure portal from .NET Core API .NET Core 2.0-Azure函数,程序集的运行时解析期间发生异常 - .NET Core 2.0 - Azure Function, Exception during runtime resolution of assembly 在 Azure 中运行.Net Core App 24 X 7 我有哪些选择 - What are my options to run .Net Core App 24 X 7 in Azure 如何在 Powershell 中使用 Azure Function 应用程序编写文件 - How to Write Files With Azure Function app in Powershell 如何在 Azure Web App 上更新 .NET Core? - How to update .NET Core on Azure Web App?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM