I am working with ASP.net Core WebAPI and to produced API documentation I am using Swagger. Swagger successfully generate colourful documentation. But when I try to execute an api method. Always got bellow error from Swagger.
{ "error": "no response from server" }
Api Method
[Route("api/[controller]")]
[Produces("application/json")]
public sealed class AuthController : BaseApiController
{
[HttpGet]
[Route("GetByUser/{uid}/{pwd}")]
public IActionResult GetByUser(string uid, string pwd){....}
}
Note:
- I always got correct api response from above method via Browser / Fiddler (without using Swagger)
- I also configure CORS in api end. But from Swagger still not getting proper response.
Swagger AppSettings
"Swagger": {
"FileName": "ApiDoument.xml",
"host": "localhost:63687"
}
Swagger Response
Curl
X GET 'http://localhost:63687/api/Auth/GetByUser/test%40gmail.com/1234'
Request URL
http://localhost:63687/api/Auth/GetByUser/test%40gmail.com/1234
Response Body
no content
Response Code
0
Response Headers
{ "error": "no response from server" }