asp.net-core-webapi

upload large files (> 1 GB) to azure blob storage through web api

北战南征 提交于 2020-08-24 03:36:30
问题 we have an application(.Net core) that is hosted in azure app service and we are trying to upload large files to Azure blob through web API using Form data from UI. We have changed request length and API request timeout still we are facing connection time out errors even while uploading 200MB files below is the sample code I am using [HttpPost] [Route("upload")] [Consumes("multipart/form-data")] [RequestFormLimits(MultipartBodyLengthLimit = 2147483648)] public async Task<IHttpActionResult>

Clarification on how IAsyncEnumerable works with ASP.NET Web API

廉价感情. 提交于 2020-08-22 11:41:46
问题 I encountered an interesting behavior while exploring IAsyncEnumerable in an ASP.NET Web API project. Consider the following code samples: // Code Sample 1 [HttpGet] public async IAsyncEnumerable<int> GetAsync() { for (int i = 0; i < 10; i++) { await Task.Delay(1000); yield return i; } } // Code Sample 2 [HttpGet] public async IAsyncEnumerable<string> GetAsync() { for (int i = 0; i < 10; i++) { await Task.Delay(1000); yield return i.ToString(); } } Sample 1 (int array) returns {} as JSON

An error when sending PATCH with Postman to Asp.net Core webapi

让人想犯罪 __ 提交于 2020-08-20 03:39:29
问题 I have a model, public class Order { public Guid Id { get; set; } public IEnumerable<string> ItemIds { get; set; } public string Currency { get; set; } } and a repository, public interface IOrderRepository { IEnumerable<Order> Get(); Order Get(Guid id); void Add(Order order); void Update(Guid id, Order order); // other irrelevant code has been deleted for simplicity } public class MemoryOrderRepository : IOrderRepository { private readonly IList<Order> _orders = new List<Order>(); public

Turn off mvc request logging in asp.net core 2.2 with serilog

余生颓废 提交于 2020-08-10 03:32:49
问题 I am using Serilog.Extensions.Logging.File to logs in file. Here is my appsettings.json file: "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "Information", "System": "None", "Microsoft": "None" } }, "LoggingFile": { "IncludeScopes": false, "pathFormat": "C:/logs/APILogs-{Date}.log", "LogLevel": { "Default": "Trace", "System": "None", "Microsoft": "None" } } My Startup.cs code: public void Configure( IApplicationBuilder app, IHostingEnvironment env,

Turn off mvc request logging in asp.net core 2.2 with serilog

谁说我不能喝 提交于 2020-08-10 03:32:28
问题 I am using Serilog.Extensions.Logging.File to logs in file. Here is my appsettings.json file: "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "Information", "System": "None", "Microsoft": "None" } }, "LoggingFile": { "IncludeScopes": false, "pathFormat": "C:/logs/APILogs-{Date}.log", "LogLevel": { "Default": "Trace", "System": "None", "Microsoft": "None" } } My Startup.cs code: public void Configure( IApplicationBuilder app, IHostingEnvironment env,

Turn off mvc request logging in asp.net core 2.2 with serilog

被刻印的时光 ゝ 提交于 2020-08-10 03:32:10
问题 I am using Serilog.Extensions.Logging.File to logs in file. Here is my appsettings.json file: "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "Information", "System": "None", "Microsoft": "None" } }, "LoggingFile": { "IncludeScopes": false, "pathFormat": "C:/logs/APILogs-{Date}.log", "LogLevel": { "Default": "Trace", "System": "None", "Microsoft": "None" } } My Startup.cs code: public void Configure( IApplicationBuilder app, IHostingEnvironment env,

How to change registered (Simple Injector) DbContext's connection string after user's authorization?

余生长醉 提交于 2020-08-09 08:14:43
问题 I'm building ASP.NET Core Web Api with Simple Injector and have the following problem: The data for each user is stored in his individual base (but with the same schema), which is known only after he authorizes himself. So... I can give DbContext it's proper connection string only after user's authorization. What is the best way to accomplish this? For now I am storing the connection string in HttpContext custom claim and am refering to it with a use of a static helper class in DbContext 's

How to change registered (Simple Injector) DbContext's connection string after user's authorization?

巧了我就是萌 提交于 2020-08-09 08:13:54
问题 I'm building ASP.NET Core Web Api with Simple Injector and have the following problem: The data for each user is stored in his individual base (but with the same schema), which is known only after he authorizes himself. So... I can give DbContext it's proper connection string only after user's authorization. What is the best way to accomplish this? For now I am storing the connection string in HttpContext custom claim and am refering to it with a use of a static helper class in DbContext 's