0

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" }

Shubhajyoti Ghosh
  • 1,292
  • 5
  • 27
  • 45

1 Answers1

0

Problem is resolve, above described error due to bellow Hash value. Swagger unable to return this type of value.

AQAAAAEAACcXdXU4rzH9EpRzS2smaRdvesNxkOQMvKld2ySuzXTNcd+1Gux6CJfV90w==

Solution:

using Newtonsoft.Json;

JsonConvert.SerializeObject(Hashvalue);
Shubhajyoti Ghosh
  • 1,292
  • 5
  • 27
  • 45