admin管理员组

文章数量:1122832

We have an existing API project and being intriguied by Aspire decided to try and add it to our solution. This seems to have worked okay and the dashboard launches with our api listed, however, every request returns with a http 200 repsonse and empty content.

It seems to be handling the endpoints correctly as any incorrect ones are returned with a 401 (which is how it's always worked).

The logs from the project are showing that the api is hit, howver, it doesn't return the correct data. As a test I've setup this endpoint

app.MapGet("/test", () => { return "test"; }).AllowAnonymous();

this is from the logs:

Request starting HTTP/1.1 GET https://localhost:7122/test - - -
Request finished HTTP/1.1 GET https://localhost:7122/test - 200 0 - 6.7426ms

and the postman response:

GET https://localhost:7122/test
200
11 ms
Warning: Unable to verify the first certificate
GET /test HTTP/1.1
User-Agent: PostmanRuntime/7.42.0
Accept: */*
Postman-Token: f8286ede-50e6-4e49-9543-f3b628577b7f
Host: localhost:7122
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
 
HTTP/1.1 200 OK
Content-Length: 0
Date: Thu, 21 Nov 2024 12:17:13 GMT
Server: Kestrel

(note the cerificate warning has been there since ever and doesn't normally affect the operation)

I'm not sure if there's something I'm missing, that I haven't configured properly or have made an obvious mistake....

EDIT: It seems that in the newly added code for AddServiceDefaults there is a resilience strategy added http.AddStandardResilienceHandler();. Disabling this for now remedies the issue.

We have an existing .net API project and being intriguied by Aspire decided to try and add it to our solution. This seems to have worked okay and the dashboard launches with our api listed, however, every request returns with a http 200 repsonse and empty content.

It seems to be handling the endpoints correctly as any incorrect ones are returned with a 401 (which is how it's always worked).

The logs from the project are showing that the api is hit, howver, it doesn't return the correct data. As a test I've setup this endpoint

app.MapGet("/test", () => { return "test"; }).AllowAnonymous();

this is from the logs:

Request starting HTTP/1.1 GET https://localhost:7122/test - - -
Request finished HTTP/1.1 GET https://localhost:7122/test - 200 0 - 6.7426ms

and the postman response:

GET https://localhost:7122/test
200
11 ms
Warning: Unable to verify the first certificate
GET /test HTTP/1.1
User-Agent: PostmanRuntime/7.42.0
Accept: */*
Postman-Token: f8286ede-50e6-4e49-9543-f3b628577b7f
Host: localhost:7122
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
 
HTTP/1.1 200 OK
Content-Length: 0
Date: Thu, 21 Nov 2024 12:17:13 GMT
Server: Kestrel

(note the cerificate warning has been there since ever and doesn't normally affect the operation)

I'm not sure if there's something I'm missing, that I haven't configured properly or have made an obvious mistake....

EDIT: It seems that in the newly added code for AddServiceDefaults there is a resilience strategy added http.AddStandardResilienceHandler();. Disabling this for now remedies the issue.

Share Improve this question edited 2 days ago Lex Li 63.1k11 gold badges123 silver badges159 bronze badges asked Nov 21, 2024 at 12:17 Paul CharltonPaul Charlton 5214 silver badges14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

As per the edit

It seems that in the newly added code for AddServiceDefaults there is a resilience strategy added http.AddStandardResilienceHandler();. Disabling this for now remedies the issue.

本文标签: aspnet coreNet Aspire 9To existing ProjectAlways returns empty 200 reponsesStack Overflow