Use Stack Overflow for Teams at work to find answers in a private and secure environment. Get your first 10 users free. .

Questions tagged [asp.net-web-api]

ASP.NET Web API is a framework for building HTTP services for clients like browsers and mobile devices. It is based on the Microsoft .NET Framework and an ideal choice for building RESTful services.

Filter by
Sorted by
Tagged with
-2
votes
0answers
20 views

passing and receiving dynamic collection in webapi

I have one C# structure public class Model { public ObservableCollection<dynamic> AllEvents { get; set; } public ObservableCollection<dynamic> AllConsideration { get; set;} } and ...
1
vote
1answer
41 views

Web API Post with multiple parameters

When I call the post web API I'm getting 404 Not found response [HttpPost] [Route("api/timesheet/submittimesheet/{fullname}")] public HttpResponseMessage SubmitTimeSheet([FromUri]string fullname, [...
0
votes
3answers
47 views

How to call web api with multiple parameter in c# xamarin forms

I know this is a repeated question. I have tried many examples showed on stackoverflow. But the API is still not calling and it shows 404 not found error. I have tried the below examples, Example 1: ...
0
votes
1answer
29 views

Why does my Web ASP controller in ASP.NET 4.5 respond with an error for several controller?

I have a Web API, it's using ASP.NET 4.5. I have tested that API returns a success response, and then after several months, my controller suddenly returns error responses. This is how I inject my ...
0
votes
1answer
21 views

In C# WebAPI, how do I configure CORS to allow a POST request with credentials and json content?

I have the following headers in my WebAPI web.config: <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="https://localhost:44379" /> &...
1
vote
2answers
30 views

How to check phone number is unique in AspNetUsers table when using ASP.NET Web Api

I have created an Asp.Net Web Api project and used Individual user accounts. When I am adding users to the table the default system automatically checks if the email address supplied already exists in ...
-2
votes
0answers
27 views

Relational API Model

I'm trying to achieve the data of NodesIPAddress and from NodesIPAddress method I'm trying to get its interface details, both model have common field called NodeID. I'm to looking to achieve this ...
-1
votes
0answers
13 views

Unified Way For Finding The PAth Of Content File For Both ASP.NET and WPF

I have an ASP.NET Web Api application and a WPF application. Both of these solutions use another library project. And in that library project, I have a file with Build Action:Content. When trying to ...
0
votes
1answer
31 views

Bearer token: The signature is invalid - Default ASP.NET Core 2.1 Web Api template published to Azure

I created a project in VS Community 2019 (latest update) with a template for WebApi .NET Core 2.1 and published it on Azure. I only added a client secret in the app registration in the portal to use ...
0
votes
1answer
39 views

Call Web APi from MVC Project

I have created Web API using Oracle Database in C# ASP.NET MVC and ADO.NET Entity Model and everything works fine. And right now, I need to create a another project which will call this API. I ...
0
votes
0answers
29 views

How can i automatically login with my demo user and password with a link?

I'm using .net core 2 with my project, i'v created a demo user with limited permissions. i'm tring to create a link in the login page that automatically login with this demo user, it have a password. ...
0
votes
1answer
28 views

How to show responses example in swagger documenation

I developed asp.net web API and I used swagger to API documentation and consume purposes. I need to show swagger response model sample in swagger documentation as follows This image I got from the ...
-2
votes
0answers
26 views

How do I store/access session information in a web api controller

How do I store/access session information in a web api controller? My requirement is to store data in session, and retrive. I'm getting runtime exception as Object reference not set to an instance of ...
0
votes
2answers
25 views

How to do the update into database when I'm passing DTO then converted to Model in Web API 2

I have the following PUT method for web api for updating the record. Since I've modified to incorporate the DTO and then converted back to model in order to save to the database, I have the following ...
0
votes
0answers
30 views

Xamarin forms iOS app has stopped communicating with local WebAPI timeout exception

My app on the iOS emulator stopped communicating with the local WebAPI suddenly. I have a Xamarin App (only for iOS) which communicates with the database using APIs. I have built another Web API ...
-1
votes
3answers
51 views

unable to get result showing Object reference not set to an instance of an object

i want get last record of table with particular column value. after that i need to increment value ..here table is empty and column propery is string public async Task<string> ...
0
votes
0answers
21 views

Getting error Make sure that the controller has a parameter less public constructor c#

I am getting 2 errors in the controller when calling the Web API. **Make sure that the controller has a parameterless public constructor.** and **The current type IDatabaseProvider, is an ...
0
votes
1answer
25 views

URL not found when trying to make a request

I tried to make a post request in Postman to the server(WebApi) to save an item. This is the error message { "Message": "No HTTP resource was found that matches the request URI 'http://...
-1
votes
1answer
38 views

How to implement the observer pattern for REST API's? (Between Frontend and backend)

I want to subscribe once to api and and i should get multiple response from api untill i unsubscribe that event. i) First of all. Is it possible ? ii) If yes then how ? If no then why it is not a ...
-2
votes
0answers
25 views

What are the tasks\methods to be implemented to develop an Azure Storage kind in the local server

My Requirement I need to develop Azure Storage kind in my local server. Its main purpose is to reduce cost by giving a Azure kind environment for the customer in the local server. I would use SQL ...
-1
votes
0answers
18 views

I am using asp.net web api service in ionic. But its not getting service data in real device

I am using angular Httpclient to call asp.net web api in ionic application all working fine its getting data from service in localhost:8200 but when it comes to real device the service response with ...
0
votes
0answers
6 views

Web Api Crystal report Export show blank pdf

I am trying to return crystal report in pdf format from webapi controller. it is showing me blank pdf on export. Could you please help what I am doing wrong here. [Route("Printinvoice/{id:...
0
votes
0answers
38 views

Return two JSON objects From WEB API in same call SQL 2016

I'm using AXIOS in a Vue application that calls a .NET WEB API. So client side is JavaScript in a Vue.js page. All of my calls so far call one JSON object. Below is my simplified code. Declare @...
0
votes
1answer
25 views

Trouble with ActionResult in unit test can't Assert.Equal on POST return value (asp.net core mvc web api)

I'm new to testing .net core web APIs and am struggling to test the POST method on my API. I can assert the type of the ActionResult that is returned, but I can't seem to figure out how to compare the ...
0
votes
0answers
19 views

Overload resolution of MVC Web API operations with FromUri/FromBody

Can anyone provide some insight as to how overload resolution works in MVC Web API? Let's assume the same HTTP method for all operations, say GET, as that part's clear enough. Now, let's asume I ...
0
votes
1answer
25 views

How to set PhoneNumber in AspNetUsers table when using individual user accounts

I have created a new Asp.Net Web API project and used the authentication type "Individual User Accounts" which created a database with some default tables. I then created a number of accounts with ...
0
votes
0answers
33 views
+50

OWIN web api CancellationToken not being called

I'm using C# Web-Api with Owin, hosted as a Windows Service, to expose card reader utility. I'm trying to use Server Sent Events. The client sends a request to open the stream, and I want to do logic ...
0
votes
1answer
56 views

Uploading Image in .NET Core Web API

I'm developing a Web API with .Net Core, where I need to allow a client to upload a list of files (mostly images) and save them to the server. Im using ASP.NET Core 3.0 This is my startup file ...
0
votes
1answer
29 views

SignOutAsync() not logging user out

I have a MVC app that has a couple of WebAPI endpoints. The reason for this is we have an app that should be able to communicate with the application. For authentication, I am using Identity. After ...
0
votes
0answers
18 views

Error when scaffolding Controller for new WEB Api application

I am creating a new WEB Api application and added a new Model class. The problem is that when I try to scaffold a new controller for it I keep getting this error. I tried searching for a solution but ...
0
votes
1answer
20 views

How to get the list of employees according to mat-radio-button click [active / inactive / all]

I have a list of employee's including (active, inactive employee's) displayed in dashboard. So now I want to display by default only active employee's list. If I click on Inactive radio button, then ...
0
votes
1answer
26 views

Extra layer for communication from client to Service via client ->Api->ESB->Service

We are architecting a new system where ESB is the centerline channel for service communication. as we don't want our HTML/js client to interact with a bus directly, so we decided to introduce Api (...
0
votes
1answer
36 views

AJAX Won't return value from web api c#

I have a simple web api created in C# which a method that returns a string public string Get() { return "Welcome Web API online"; } I am now calling it via javascript, It ...
0
votes
0answers
22 views

A client is accessing our angular web app in Citrix and occasionally freezes for multiples of 5 minutes

This is a bit of a vague question I'm afraid, but I thought I'd ask just in case anyone had any idea. We have a cloud based angular web app with a .Net web api. The big caveat here is that I haven't ...
0
votes
1answer
42 views

ASP.NET Core Authentication via Google Sign In with REST API in between

I have a requirement to authenticate ASP.NET Core App via Google Sign In, but a Web API between client app (i.e. ASP.NET Core app) and Google sign in... I know it sounds confusing, so let me explain ...
0
votes
1answer
20 views

Authenticate against Azure AD

I'll try to make this as straight-forward as possible. I have a ASP.NET Web API application running in Azure. I generate JWT tokens for callers, who authenticate with my service by sending in the ...
0
votes
2answers
45 views

3-tier Architecture business logic

I have a question about Service Layer - now my controllers interacts with Service Layer where I work with EF Context but sometime business logic inside Service methods can be really huge approximately ...
2
votes
2answers
57 views

IIS - Thread pool setting machine.config vs web.config

I am running a ASP.NET 4.5 Web API application on IIS 8.5. Under worker process, I am seeing certain request are queued up by IIS and are never being served. This could be a memory leak issue. I am ...
0
votes
3answers
85 views

Image upload in .NET Core Web API

I'm developing a Web API with .Net Core, where I need to allow a client to upload a list of files (mostly images) and save them to the server. Im using ASP.NET Core 3.0 This is my startup file ...
0
votes
0answers
23 views

Web Api replies to request on ipv6, but not on ipv4

I have created a very simple Web API controller that responds to a simple Ping call. The problem is that it replies to IPv6 request only, not IPv4. [HttpGet] [Route("api/test/ping")] public ...
1
vote
1answer
35 views

Resolve an issue for Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException

I have an issue during an insert operation into the table using Entity Framework Core. _context.Entry(item).State = EntityState.Added; var r = await _context.ServiceWorkOrders.AddAsync(item); ...
-1
votes
0answers
37 views

How to compare input value with value in microsoft sql server

I want to send out message if input value is more than the value inside database I only managed to compare input with 0. if 0 value. message return Transaction unit must not be 0. I want to validate ...
1
vote
3answers
64 views

Server Error in '/' Application. (The resource cannot be found. )

I have created an MVC project in Visual Studio 2017 , i have added few controllers for Web pages which are working fine , Now i want to create web APIs in the same project , so for that in App_Start ...
0
votes
1answer
30 views

How do I subscribe to and raise an event within the same post method of my controller?

When an instance of my model MyPost is posted and it has a property with a certain value, e.g. Type = "Question", I want to save the Question, subscribe to an event NoMoreAnswers and wait for a ...
0
votes
0answers
38 views

Is it a good practice to create Local Classes for each Action in .NET Web Api? [closed]

For example: Let's say we have a User Class as the following public class User { [Key] public int Id { get; set; } [Required] public string Name { get; set; } [Required] ...
0
votes
0answers
9 views

Create a route for parent-child scenario

I have a parent entity Schedule that models running a task, job,exe at some point in time. I have a child entity Schedule History that captures each run of a schedule.I have a following schedule ...
3
votes
1answer
108 views
+200

How to send an error response back to OAuth2 client

Identity Server 4 redirects to the AccountController for login, once the user is validated the HttpContext.SignInAsync method is called and then a Redirect to the ReturnUrl is performed. However, in ...
1
vote
2answers
79 views

How to read json file in asp.net web api

In my asp.web api 2.0 project I have a Json file, where all the error codes are mapped. I want to read the json file in order to return response to the caller. I am unable to read the same, however ...
0
votes
1answer
52 views

Slow response from asp.net web api

I'm wondering if anyone has any as to why a response from a web api can be slow from the second it is requested to when it is returned. I thought it was the code within the action in the controller ...
1
vote
0answers
86 views

Why am I getting “The current type IDatabaseProvider, is an interface and cannot be constructed.” from Unity container?

I am getting 2 errors from Unity Container while calling Web API: Make sure that the controller has a parameterless public constructor. and The current type IDatabaseProvider, is an interface ...