Skip to main content
Filter by
Sorted by
Tagged with
0 votes
3 answers
141 views

Say I have this interface: public interface IExample { string GetSupportedExtension(); void DoWork(Stream input); } a concrete implementation like: public class PdfExample : IExample { ...
2 votes
1 answer
930 views

I am working on a ASP.NET WebApi project. I have a model class that has a property that I don't want to serialize in public calls. For this purpose I am usin [JsonIgnore] for that property and it is ...
9 votes
2 answers
22k views

I am getting the an exception with the following route attribute: [Route("{id}?action=decline")] Exception: An exception of type 'System.ArgumentException' occurred in System.Web.Http.dll but was ...
10 votes
1 answer
14k views

I am following this Microsoft Docs tutorial and everything appears to work upto the point where I call the web api with the access token using Postman. To be specific: I request a token, Azure AD ...
2 votes
1 answer
10k views

In my ASP.Net Web API Project, i added [Authorize] attribute to the controller. So when i call the method it is returning error as "Message": "Authorization has been denied for this request." How to ...
29 votes
5 answers
16k views

I am asking if anyone knows if it is possible to to pass into a Web Api a concrete class that inherits from a abstract class. For example: public abstract class A { A(); } public class B : A { } ...
1 vote
1 answer
281 views

I have cleaned and rebuilt numerous times as well as closed and reopened VS 2015. I have solid red break point and the code executes, other controllers with breakpoints are hit. I don't understand ...
2 votes
4 answers
19k views

I had same issue ( link https://superuser.com/questions/394223/iis-cannot-access-folder-for-website-hosting) I hosted web api service in iis when i hosted i got internal server error i found solution ...
8 votes
8 answers
27k views

I have an ASP.NET WebAPI project where I am attempting to replace our old XmlDocumentationProvider page with Swagger UI. I am using the swashbuckle swagger for webAPI 5.3.1 nuget package. I am able ...
26 votes
3 answers
14k views

I'm trying to configure Serilog for a Web API project in .NET 6. Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(builder.Configuration) .Enrich.FromLogContext() ....
0 votes
0 answers
57 views

I have an ASP.NET Web API project using Autofac for dependency injection. I register a factory for creating ICommandExecutor based on an enum: builder.Register<Func<CommandType, ICommandExecutor&...
92 votes
11 answers
245k views

I have followed this article to implement an OAuth Authorization server. However when I use post man to get a token, I get an error in the response: "error": "unsupported_grant_type" I read ...
2 votes
2 answers
3k views

I have a WebAPI - .NET framework 4.6.2 I am getting below error on the accessing the webapi via swagger: Can't read from server. It may not have the appropriate access-control-origin settings. I ...
4 votes
1 answer
2k views

I have a generic WebApi controller with CRUD operations like this: public abstract class BaseController<TEntity> : ApiController where TEntity : class { protected abstract DbSet<TEntity&...
1 vote
3 answers
703 views

I have an existing Web API project, which uses Azure AD for authentication. Prior to my joining the organisation, I understand that this was an ASP.Net 3.1 project, that has since been upgraded to ASP....
0 votes
1 answer
4k views

I have a requirement to implement simple edit functionality. I am using webapi service to update my test object. I am calling the below method from the controller post request. This is the controller ...
1 vote
0 answers
76 views

I have built a form which take checkInDate and nights as input. But in the backend when I am debugging it is not showing the date correctly. It is displaying nights correctly but checkInDate is shown ...
3 votes
1 answer
1k views

(Disclaimer): I know what an ambiguous reference is and how to solve it. I am just confused why this appears here I have the following code: using SMBLibrary; namespace SquirrelCam { public class ...
1 vote
0 answers
142 views

I did a research in the official page of the RestEase but I don't find a way to post a xml data to a Web API controller. Is any one have experience to do it? thank you very much
1 vote
1 answer
2k views

I want to install Install-Package Microsoft.AspNet.WebApi.Client. Using From the Tools menu, select Library Package Manager, then select Package Manager Console. In the Package Manager Console window, ...
0 votes
3 answers
1k views

I am sending email using gmail and getting the following error: Error sending email: A connection attempt failed because the connected party did not properly respond after a period of time, or ...
8 votes
3 answers
9k views

So I tried to add async methods to my routes and to the interfaces, repositories etc and I coded everything properly. Everything looks great but when I try to run the app I get that error: Error ...
2 votes
5 answers
3k views

My question is referring to this question. The answer shows only solutions where you would have to change the type of the method to HttpResponseMessage or string. This is my method: public ...
48 votes
2 answers
80k views

System.Net.Http.Json's HttpClient extension methods such as GetFromJsonAsync() greatly simplifies the routine codes to retrieve json objects from a web API. It's a pleasure to use. But because of the ...
1 vote
1 answer
106 views

I'm building a .NET 8 Web API that connects to MetaTrader 5 using the MT5 Manager API. Everything works perfectly when running locally from Visual Studio. However, after publishing and deploying the ...