Category "asp.net-core-webapi"

Where to call EF Core Migrate in web API startup class?

I'm trying to process DB migrations during application startup in a Azure-hosted web API. However, no matter where I try to put it, I get the exception: ObjectD

Best practicies global result - error handling in Asp.Net core 3 and Angular 9

According to Microsoft's recommendation, throwing and catching should not be used for the normal logic of the program. Minimize exceptions As part of a ASP.Net

Asynchronously Streaming Video with .Net Core API from Azure Blob Storage

I have found a bunch of examples that use objects not available to me within my application and don't seem to match up to my version of .NET Core web API. In es

ASP.NET Core api controller not being instantiated

I've created an API controller in my .NET Core 3.1 application (with an Angular frontend, C#). For some strange reason its not being instantiated, if I try to c

TCP Client/Server hosted in Kestrel

I would like to create a simple TCP Server / TCP Client and use a Controller to interface with that classes, to then host the controller in a kestrel webserver

Global route for all ApiControllers in .Net 6

In all of my projects i put this code in top my controllers : [Route("api/[controller]/[action]")] [ApiController] public class ValuesController : ControllerBas

The specified CGI application encountered an error and the server terminated the process. - timeout issue

Getting below error for API which takes around 2-4 minute to process Code:502 Error: Bad Gateway The specified CGI application encountered an error and the serv

I want scope checkbox checked by default swagger Nswag

Here is Swagger/OpenAPI definition: services.AddOpenApiDocument(document => { document.DocumentProcessors.Add(new SecurityDefinitionAppe

How to use localization with data annotation in a separate DTO Assembly (Asp.net Core Web Api)

I have: a Dto.Library (.Net 5 Library) a SharedResourceLibrary with Resource.resx (.Net 5 Library) How can i use the Resource File Messages in conjunction with

Invalid character in header content ["Host"] Postman

When i try to test api with localhost:[port] it gives the invalid character in header ["Host"] console error. I am using dotnet core webApi. I cross checked the

Why is web.config getting created on publish not on build the project in Asp.Net Core API?

I have Asp.net Core 3.1 API project. When I build it doesn't create any web.config file, but when I publish the API using VS 2019 in a folder, it creates a web.

How to add bearer token authentication to typed HttpClient in Asp.Net Core 6

I'm trying to setup a web api using ASP.Net Core 6 so that users can hit my end points and then I do some work in D365 behind the scenes using a privileged acco

Web Api Return File with additional data

I'm returning a file as follows: public async Task<IActionResult> GetFile(string id) { try { Get

Cannot create database migration on EF Core but It can when you ask to EnsureCreate database

I am trying to inject some repository to a service and some services to a controller but I am using the DbContext is an assembly that is not the startup projec

Cannot create database migration on EF Core but It can when you ask to EnsureCreate database

I am trying to inject some repository to a service and some services to a controller but I am using the DbContext is an assembly that is not the startup projec

ASP.NET Core: [FromQuery] usage and URL format

I am trying to use [FromQuery] in my web api and I am not sure how to use it. Here's the GetAllBooks() method in the controller: [HttpGet] [Route("api/v1/Sh

How to declare global variable in Program cs and use it in controllers in .NET 6.0 Web Api

I have default Program.cs file from Web Api template in .NET 6.0. I am adding variable "test" so I can use its value in controllers. var builder = WebApplicatio

How to declare global variable in Program cs and use it in controllers in .NET 6.0 Web Api

I have default Program.cs file from Web Api template in .NET 6.0. I am adding variable "test" so I can use its value in controllers. var builder = WebApplicatio

Getting Unsupported Media Type for .net core

I'm new in backend development and Gettig 415 Unsupported Media Type in multipart API written in .net core. I have attached the postman image for your reference

How to integrate SOLMAN with my Rest API?

I am working on a project that requires SAP Solution Manager (SOLMAN) to be integrated with Azure Devops Rest API. Functionality: Whenever a Work Package is cre