在具有通用主机的 .NET Core 2.1 应用程序中使用 IConfigurationBuilder 时,我配置了 4 个源;但是在 ConfigureAppConfiguration 的范围之后,有 6 个来源。
在某些时候,我已经加载的 2 个附加源以导致 appsettings.Environment.json 值被隐藏的顺序第二次添加。我还尝试删除 hostsettings.json 配置并验证这不会影响到这一点。这是针对使用 WebjobsSDK 3.0 和 .Net Core 2.1 的 Azure Webjob
var builder = new HostBuilder()
.ConfigureHostConfiguration(configurationBuilder =>
{
//This is to do some basic host configuration and should only add 2 sources
configurationBuilder.SetBasePath(Directory.GetCurrentDirectory());
configurationBuilder.AddJsonFile("hostsettings.json", optional: true);
configurationBuilder.AddEnvironmentVariables(prefix: "APPSETTING_ASPNETCORE_");
})
.ConfigureAppConfiguration((hostContext, configurationBuilder) =>
{
//at this point there are 0 sources in the sources
IHostingEnvironment env = hostContext.HostingEnvironment;
configurationBuilder.SetBasePath(Directory.GetCurrentDirectory());
configurationBuilder.AddJsonFile("appSettings.json", optional: false, …Run Code Online (Sandbox Code Playgroud) 我们有一个在 Azure 中托管的项目,我们将 SQL 服务器存储在弹性池中。我们拥有的数据库是从 .NET 框架的 Code First 迁移生成的;我们使用一些 SQL 导入脚本将数据加载到数据库中。
问题在于将数据库部署到 Azure。我们尝试在开发计算机和 SQL Server 上使用 SQL Server Management Studio。我们尝试使用将数据库部署到 Microsoft SQL Azure 将数据库推送到 Azure,并尝试使用 BACPAC 直接连接到 Azure 和导入数据层应用程序。SQL Server 2014 12.0.4439.1 是我们的服务器版本。
在部署过程中,一切似乎都进行得非常快,模式已创建,数据已加载到表中,但在大部分过程时间中它都挂在“启用索引”上,大约一个小时后,整个过程超时并失败。我收到 3 个错误;第一个是错误0;关于面向 SQL Server 2014 的数据库文件,已知与 SQL azure v12 的兼容性,这是非常神秘的。另一个关于超时,带有进程已超时的通用消息。最后的错误是注释
Could not import package.
Error SQL72016: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated.
Error SQL72045: Script execution error. …Run Code Online (Sandbox Code Playgroud)