asp.net-web-api

Api Gateway and Sharing Service Models

一笑奈何 提交于 2020-08-26 03:37:28
问题 The short version of my question is that I'm trying to wrap my head around how models are "shared" between an API Gateway and internal microservices. I assume that the gateway can be responsible for transforming calls to multiple services and returning a new aggregated representation of the data. How does the gateway know about the available models from the microservices? In my simple example. I have: API Gateway User Service Restaurant Service User Service This rest service would expose an

ThreadAbortException when calling Task.Result

China☆狼群 提交于 2020-08-24 06:26:13
问题 I have the following code where I'm trying to make a request to a remote endpoint using HttpClient : using (var client = new HttpClient()) { client.BaseAddress = _serviceBaseAddress; Task<HttpResponseMessage> readResponseTask = client.GetAsync(relativeUri); readResponseTask.Wait(); using (var response = readResponseTask.Result) { if (response.StatusCode == HttpStatusCode.NotFound || !response.IsSuccessStatusCode) { return default(TResult); } Task<TResult> readContentTask = response.Content

Response Cookie not getting set by Chrome & IE

巧了我就是萌 提交于 2020-08-22 05:32:26
问题 I'm trying to figure out why Chrome (26.0.1410.64) and IE10 don't seem to recognize the cookie I set in my response from an ASP.NET Web API controller. Here is the situation: I have a drop-down menu login form on my page that makes an ajax call to my Web API method (via HTTP POST) and that Web API method returns some JSON data and also sets a cookie in the response (using the HTTP headers). It works perfectly in Firefox and Safari (so, WebKit) but not in Chrome or IE. Chrome and IE appear to

Multiple Serilog Loggers

自作多情 提交于 2020-08-09 08:17:29
问题 Is it possible to have multiple serilog loggers? Currently within my WebApi I can call Log.Information for example to log an information event, but is there a way that I can instead make different logs and call ExternalLog.Information or AuthenticationLog.Information from my controller? The purpose behind this is that my web api is currently working with multiple different databases for different yet interrelated projects, and I would like to store logs within each of these databases that

HttpClient returns 401 with correct authorisation header

亡梦爱人 提交于 2020-08-08 21:12:45
问题 I have been trying for a while now to consume the eventbrite api with vb.net, I am using the HttpClient to consume the api however it only returns a HTTP 401 Unathorised when I call the same method with the same headers using postman it returns the expected response with a HTTP 200 OK VB.Net Dim objClient As New HttpClient() objClient.BaseAddress = New Uri("https://www.eventbriteapi.com/v3/") objClient.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer",

HttpClient returns 401 with correct authorisation header

邮差的信 提交于 2020-08-08 21:03:15
问题 I have been trying for a while now to consume the eventbrite api with vb.net, I am using the HttpClient to consume the api however it only returns a HTTP 401 Unathorised when I call the same method with the same headers using postman it returns the expected response with a HTTP 200 OK VB.Net Dim objClient As New HttpClient() objClient.BaseAddress = New Uri("https://www.eventbriteapi.com/v3/") objClient.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer",