嘿,我已经使用 Azure dev ops CI/CD 部署了新的 azure 功能。函数应用程序已成功部署,当我转到主 URL 时,它表示您的函数应用程序正在运行。我尝试使用 azure 门户测试端点(“/save”),输出为 404 Not find。当我使用 POST man 时也得到相同的结果。任何帮助,将不胜感激?
 2020-11-21T11:30:45.769 [Error] The following 2 functions are in error:
 Get: The function type name 'DocumentContextFunction.Functions.GetDocument' 
 is invalid.
 Save: The function type name 
 'DocumentContextFunction.Functions.SaveDocument' is invalid.
根据https://learn.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection,在启动完成运行之后才应使用服务提供程序。事实上,如果我尝试获取注册服务,它将失败。
例子:
[assembly: FunctionsStartup(typeof(Startup))]
namespace Fx {
    public sealed class Startup : FunctionsStartup {
        public override void Configure(IFunctionsHostBuilder builder) {
            var configurationBuilder = new ConfigurationBuilder();
            configurationBuilder.AddEnvironmentVariables();
            var configuration = configurationBuilder.Build();
            builder.Services.AddInfrastructure(configuration);
            builder.Services.AddApplication();
            var serviceProvider = builder.Services.BuildServiceProvider();
            DependencyInjection.AddDatabase(serviceProvider).GetAwaiter().GetResult();
        }
    }
}
    public static class DependencyInjection {
        public static async Task AddDatabase(IServiceProvider services) {
            using var scope = services.CreateScope();
            var serviceProvider = scope.ServiceProvider;
            var context = serviceProvider.GetRequiredService<ApplicationDbContext>();
            //Error generated here
            if (context.Database.IsSqlServer()) {
                await context.Database.MigrateAsync();
            }
            await ApplicationDbContextSeed.SeedSamplePersonnelDataAsync(context);
        }
        public …migration entity-framework .net-core azure-functions azure-function-app
我的 python 文件位于 Azure DevOps 存储库中。我正在尝试将其部署到 azure 函数应用程序并执行 py 文件。我已经建立了一个服务连接“测试”来连接资源组。我的代码如下。
脚步:
但是,我遇到错误##[错误]错误:无法同步函数应用程序“api”的触发器。错误:BadRequest - 在主机运行时遇到错误 (ServiceUnavailable)。(代码:400)
我们基于Azure功能构建了API,并且所有API都是基于Python的。我知道 APIM 提供了一种导入 Azure 函数以及创建和管理 API 的好方法。然而,我正在为开发人员寻找一种轻便快速的解决方案,以便他们可以相互合作。
Swagger 在 Java 生态系统中非常流行,我们只需添加一些注释即可在 Spring Boot 应用程序中使用。
对于用 Python 编写的 Azure 函数,是否有类似的功能可用。我的最终目标是通过某些端点公开 API 文档,以便不同的团队(API 生产者和消费者)可以高效工作,而无需经过融合等
我的要求是使用 IOptions 模式从 local.settings.json 读取值
我的 localsettings.json:
{
  "IsEncrypted": false,
  "Values": {
    "MyOptions:MyCustomSetting": "Foobar",
    "MyOptions:DatabaseName": "Confirmed",
    "MyOptions:Schema": "User",
    "MyOptions:Role": "Dev",
    "MyOptions:UserName": "Avinash"
  }
}
我的绑定类看起来像:
public class MyOptions
    {
        public string MyCustomSetting { get; set; }
        public string DatabaseName { get; set; }
        public string Schema { get; set; }
        public string Role { get; set; }
        public string UserName { get; set; }
    }
启动文件
[assembly: FunctionsStartup(typeof(FunctionApp2.Startup))]
namespace FunctionApp2
{
    public class Startup : FunctionsStartup
    {
        public override void …c# .net-core asp.net-core azure-functions azure-function-app
我正在尝试通过 ARM 模板将解决方案部署为托管应用程序。为了使部署正常工作,我需要注册应用程序的客户端 ID 和客户端密钥以及租户 ID。
在我之前的范围中,我假设用户将注册一个现有的应用程序,但现在我想为用户自动化应用程序注册过程,并能够在用户的租户中注册具有 O365 API 权限的应用程序。
以下是我之前遵循的方法。
因此,与上述方法不同,我现在尝试创建一个 Web 应用程序或一个函数应用程序,它们将验证用户身份并为他们注册应用程序。
powershell azure azure-web-app-service azure-rm-template azure-function-app
在 VS2019 (16.8.3) 中创建了一个新的 Function App,HTTP 触发器以连接到 Azure Redis 缓存。从 nuget 添加了 StackExchange.Redis 2.2.4。
local.settings.json 包含 RedisConnectionFromKeyVault 的键/值和来自门户访问键的主连接字符串。
{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "RedisConnectionFromKeyVault": "<<SNIP>>.redis.cache.windows.net:6380,password=<<SNIP>>,ssl=True,abortConnect=False"
  }
}
将以下行添加到默认功能代码中:
var connectionRedis = Environment.GetEnvironmentVariable("RedisConnectionFromKeyVault", EnvironmentVariableTarget.Process);
var cache = ConnectionMultiplexer.Connect(connectionRedis).GetDatabase();
当我在本地运行并触发函数应用程序时,我在 ConnectionMultiplexer.Connect 调用中收到以下异常。
System.Private.CoreLib: Exception while executing function: Function1. StackExchange.Redis: Could not load file or assembly 'System.IO.Pipelines, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
   at StackExchange.Redis.ConnectionMultiplexer.Connect(ConfigurationOptions configuration, TextWriter log) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 1032
   at StackExchange.Redis.ConnectionMultiplexer.Connect(String configuration, TextWriter …我正在使用 Azure function app v3,我想将详细信息记录到 Application Insights 中。函数应用程序中默认有 ILogger。Ilogger和TelemetryClient将详细信息记录到 App Insights 之间有什么区别。记录详细信息的最佳方式是什么?
任何回复表示赞赏,提前致谢。
我正在学习如何使用 Azure 函数并在其中使用我的网页抓取脚本。
它使用 BeautifulSoup (bs4) 和 pymysql 模块。
当我按照 MS 指南在虚拟环境中本地尝试时,它工作正常:
但是,当我创建函数 App 并向其发布脚本时,Azure Functions 日志给出以下错误:
Failure Exception: ModuleNotFoundError: No module named 'pymysql'。
尝试导入它时一定会发生这种情况。
我真的不知道如何继续,我应该在哪里指定需要安装哪些模块?
python python-module azure azure-functions azure-function-app
请问当我启动 Function 应用程序时,如何从 Azure 存储帐户读取数据。我需要在运行时读取机器学习模型保存的权重。我想直接从存储帐户读取模型,因为模型预计每天更新,并且不想手动重新部署模型。
谢谢
azure-blob-storage azure-data-lake azure-devops azure-functions azure-function-app
azure ×5
.net-core ×2
azure-devops ×2
api-doc ×1
asp.net-core ×1
c# ×1
devops ×1
migration ×1
powershell ×1
python ×1
swagger-ui ×1