【发布时间】:2021-04-06 13:14:04
【问题描述】:
我正在尝试使用 .net 5“dotnet-isolated”部署一个 azure 函数,但无法在其上运行 sql server。这是我的配置启动
static async Task Main(string[] args)
{
#if DEBUG
Debugger.Launch();
#endif
var host = new HostBuilder()
.ConfigureAppConfiguration(c =>
{
c.AddCommandLine(args);
})
.ConfigureFunctionsWorkerDefaults((c, b) =>
{
b.UseFunctionExecutionMiddleware();
})
.ConfigureServices((context, services) =>
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(context.Configuration.GetConnectionString("DefaultConnection")));
})
.Build();
await host.RunAsync();
}
好像是
options.UseSqlServer(context.Configuration.GetConnectionString("DefaultConnection")))
无法识别 Azure 配置
【问题讨论】:
标签: .net azure entity-framework azure-functions .net-5