C# Asp.Net核心WebAPI使用AWS CloudWatch日志,未配置RegionEndpoint或ServiceURL错误

C# Asp.Net核心WebAPI使用AWS CloudWatch日志,未配置RegionEndpoint或ServiceURL错误,c#,amazon-cloudwatch,C#,Amazon Cloudwatch,当我尝试在Azure应用程序服务中部署我的Asp.Net核心WebApi时,我遇到了以下错误。我的WebApi使用Serilog.Sinks.AwsCloudWatch Exception Info: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Amazon.Runtime.AmazonClientExcept

当我尝试在Azure应用程序服务中部署我的Asp.Net核心WebApi时,我遇到了以下错误。我的WebApi使用
Serilog.Sinks.AwsCloudWatch

Exception Info: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> Amazon.Runtime.AmazonClientException: No RegionEndpoint or ServiceURL configured
   at Amazon.Runtime.ClientConfig.Validate()
   at Amazon.Runtime.AmazonServiceClient..ctor(AWSCredentials credentials, ClientConfig config)
   at Amazon.CloudWatchLogs.AmazonCloudWatchLogsClient..ctor()
   at Serilog.Sinks.AwsCloudWatch.AwsCloudWatchConfigurationExtension.AmazonCloudWatch(LoggerSinkConfiguration loggerConfiguration, String logGroup, ILogStreamNameProvider logStreamNameProvider, LogEventLevel restrictedToMinimumLevel, Int32 batchSizeLimit, Int32 batchUploadPeriodInSeconds, Boolean createLogGroup, Int32 queueSizeLimit, Byte maxRetryAttempts, LogGroupRetentionPolicy logGroupRetentionPolicy, ITextFormatter textFormatter, IAmazonCloudWatchLogs cloudWatchClient)
   at Serilog.Sinks.AwsCloudWatch.AwsCloudWatchConfigurationExtension.AmazonCloudWatch(LoggerSinkConfiguration loggerConfiguration, String logGroup, String logStreamPrefix, LogEventLevel restrictedToMinimumLevel, Int32 batchSizeLimit, Int32 batchUploadPeriodInSeconds, Boolean createLogGroup, Int32 queueSizeLimit, Byte maxRetryAttempts, LogGroupRetentionPolicy logGroupRetentionPolicy, Boolean appendUniqueInstanceGuid, Boolean appendHostName, ITextFormatter textFormatter, IAmazonCloudWatchLogs cloudWatchClient)
   --- End of inner exception stack trace ---
appSettings.json中的配置是

"Serilog": {
    "Using": [ "Serilog.Sinks.AwsCloudWatch" ],
    "Region": "ap-southeast-2",
    "WriteTo": [
      {
        "Name": "AmazonCloudWatch",
        "Args": {
          "logGroup": "test-logger",
          "logStreamPrefix": "development",
          "restrictedToMinimumLevel": "Error"
        }
      }
    ]
  }
AWS凭据检索为

    public class RegisterAwsCredentials
    {
        public static void Register()
        {
            var options = new CredentialProfileOptions
            {
                AccessKey = Environment.GetEnvironmentVariable("AWS.Key"),
                SecretKey = Environment.GetEnvironmentVariable("AWS.Secret"),
            };
            var profile = new CredentialProfile("basic_profile", options);
            profile.Region = RegionEndpoint.APSoutheast2;
            var netSDKFile = new SharedCredentialsFile();
            netSDKFile.RegisterProfile(profile);
        }
    }
当我在本地运行代码时,它工作得很好。只有在我尝试将其部署到Azure中的应用程序服务时才会发生

谁能给点建议吗?多谢各位