jeudi 18 octobre 2018

GET api without argument is working but GET api with argument not working

I have a simple web service. It has two GET APIs. One without any argument and another with a string argument.

       //GET api/without argument
        public string Get()
        {
            return "Please call the API with TimeStamp to access data.";
        }

//GET api/mydata/timestamp
public IHttpActionResult Get(string timestamp)
{
        try

            ----
            ----

            return Ok(json);
        }
        catch (Exception ex)
        {
            return NotFound();
        }    

    return NotFound();
}

PROBLEM: The API with Timestamp argument works fine on my local PC (e.g. if I use call http://localhost:49422/api/mydata/20181018091753103)

But when I deploy the web service on another PC using web deploy package then, only the API without argument works. When I try to call the API with the argument (e.g. http://ipAddress/webApiNameInDefaultWebSitePool/api/mydata/20181018091753103) then it throws error HTTP ERROR 404

I am deploying it on an anot




Aucun commentaire:

Enregistrer un commentaire