实际上,我收到 System.OutOfMemoryException for blob trigger azure function.Do I need to scale up or Scale out App Service Plan 来解决这个问题。
这两者有什么区别?
我们将Identity Server4与.NET Core结合使用,并将该应用程序部署为AWS无服务器lambda函数。当调用令牌端点以生成访问令牌时,我们收到以下错误消息:
{
"message": "Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter. Authorization header requires existence of either a 'X-Amz-Date' or a 'Date' header. Authorization=Basic Y2xpZW50OnNlY3JldA=="
Run Code Online (Sandbox Code Playgroud)
}
这是Identity Server应用程序中的ConfigurationServices方法:
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IConfiguration>(Configuration);
//connection string
string connectionString = Configuration.GetConnectionString("IdentityServer");
var rsaProvider = new RSACryptoServiceProvider(2048);
SecurityKey key = new RsaSecurityKey(rsaProvider);
var credentials = new Microsoft.IdentityModel.Tokens.SigningCredentials
(key, SecurityAlgorithms.RsaSha256Signature);
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
services.AddIdentityServer()
.AddSigningCredential(credentials)
// this adds the config data from DB …Run Code Online (Sandbox Code Playgroud) 我们正在使用EntityFrameworkCore与Identity Server4.初始设置后,身份server(localhost:6000/.well-known/openid-configuration)的发现端点工作正常.当我们尝试connect/token从邮递员调用端点时,它会给出400个错误的请求响应.这是我们的客户:
public static IEnumerable<Client> GetClients()
{
return new List<Client>
{
new Client
{
ClientId = "client",
// no interactive user, use the clientid/secret for authentication
AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,
// secret for authentication
ClientSecrets =
{
new Secret("secret".Sha256())
},
// scopes that client has access to
AllowedScopes = { ApiResourceName.Sup_Api.Description() }
},
new Client
{
ClientId = "client2",
// no interactive user, use the clientid/secret for authentication
AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,
// secret for authentication
ClientSecrets = …Run Code Online (Sandbox Code Playgroud) 我已经创建了 Http 触发器 Azure Function,其默认返回类型是Task<IActionResult>.
如果我改成有什么区别吗Task<HttpResponseMessage>?
具有返回类型的 Azure 函数Task<IActionResult>:
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
Run Code Online (Sandbox Code Playgroud)
Azure 函数具有Task<HttpResponseMessage>
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)]
HttpRequestMessage message,
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用本地设置将新项目添加到 cosmos 数据库中。
这是我的批量插入代码:
private async Task AddSubscription(EnableOrDisableSubscriptionCommand command, SubscriptionAction subscriptionAction, IList<int> notificationCategoryTypes)
{
List<Task> bulkOperations = new List<Task>();
foreach (var notificationCategory in notificationCategoryTypes)
{
var notificationTypes = Utility.GetNotificationTypes((NotificationCategoryType)notificationCategory);
foreach (var notificationType in notificationTypes)
{
foreach (var payerAccountSubscriptions in command.Subscriptions)
{
if (payerAccountSubscriptions.AccountNumbers?.Any() ?? false)
{
foreach (var accountNumber in payerAccountSubscriptions.AccountNumbers.Where(a => !string.IsNullOrEmpty(a)))
{
bulkOperations.Add(_repository.Create(subscriptionAction, notificationType,
payerAccountSubscriptions.ColCoId, payerAccountSubscriptions.PayerNumber, accountNumber, command.UserRole,
command.UserId));
}
}
else
{
bulkOperations.Add(_repository.Create(subscriptionAction, notificationType,
payerAccountSubscriptions.ColCoId, payerAccountSubscriptions.PayerNumber, null, command.UserRole,
command.UserId));
}
}
}
}
await Task.WhenAll(bulkOperations);
}
public …Run Code Online (Sandbox Code Playgroud) HTTP 触发器 Azure 函数的应用程序见解中记录了以下异常。
请求失败,因为客户端无法与跨 1 个区域的 1 个端点建立连接。尝试请求期间客户端 CPU 过载
"outerId":"0","message":"响应状态码不表示成功:ServiceUnavailable (503); Substatus: 0; ActivityId: 35d16569-41da-42ed-bc5c-8f9a5c49078e; 原因:(请求失败,因为客户端无法跨 1 个区域建立与 1 个终结点的连接。客户端 CPU 在尝试请求期间过载。\r\nActivityId: 35d16569-41da-42ed-bc5c-8f9a5c49078e,请参阅 CosmosDiagnostics、Windows/10.0.14393 cosmos-netstandard -sdk/3.9.0);","parsedStack":[{"程序集":"Microsoft.Azure.Cosmos.Client, Version=3.9.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","method":"Microsoft .Azure.Cosmos.ResponseMessage.EnsureSuccessStatusCode","级别":0,"行":0},{"程序集":"Microsoft.Azure.Cosmos.Client,版本= 3.9.1.0,文化=中性,PublicKeyToken = 31bf3856ad364e35 ","方法":"Microsoft.Azure.Cosmos.ReadFeedResponse
1.CreateResponse","level":1,"line":0},{"assembly":"Microsoft.Azure.Cosmos.Client, Version=3.9.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","method":"Microsoft.Azure.Cosmos.FeedIteratorCore1+d__6.MoveNext","级别":2,"行":0},{"程序集":"System.Private.CoreLib,版本=4.0。 0.0,文化=中性,PublicKeyToken=7cec85d7bea7798e","方法":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw","级别":3,"行":0},{"程序集":"System.Private。 CoreLib,版本=4.0.0.0,文化=中性,PublicKeyToken=7cec85d7bea7798e","方法":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","级别":4,"行":0},{"程序集" :“FleetHub.Notifications.Domain,版本= 1.0.0.0,文化=中性,PublicKeyToken = null”,“方法”:“FleetHub.Notifications.Domain.Repositories.CosmosDBRepository1+<GetItemsAsync>d__10.MoveNext","level":5,"line":0},{"assembly":"System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw","level":6,"line":0},{"assembly":"System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","level":7,"line":0},{"assembly":"System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification","level":8,"line":0},{"assembly":"FleetHub.Notifications.Queries, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","method":"FleetHub.Notifications.Queries.Handlers.RetrieveNotificationQueryHandler+<GetNotifications>d__4.MoveNext","level":9,"line":41,"fileName":"D:\\a\\144\\s\\FleetHub.Notifications.Queries\\Handlers\\RetrieveNotificationQueryHandler.cs"},{"assembly":"System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw","level":10,"line":0},{"assembly":"System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","level":11,"line":0},{"assembly":"System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification","level":12,"line":0},{"assembly":"FleetHub.Notifications.Queries, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","method":"FleetHub.Notifications.Queries.Handlers.RetrieveNotificationQueryHandler+<GetNotificationSummary>d__5.MoveNext","level":13,"line":54,"fileName":"D:\\a\\144\\s\\FleetHub.Notifications.Queries\\Handlers\\RetrieveNotificationQueryHandler.cs"},{"assembly":"System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw","level":14,"line":0},{"assembly":"System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","level":15,"line":0},{"assembly":"System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, …