WEB API 2 works on localhost but not on server

0

I'm starting with .NET Web Api 2 using .Net Core .

No Postman when I make the request on the localhost of my WebApi machine it returns a status of 200 ok, but when I do it on the server with the same WebApi it returns me 403 method not allowed (the server is already configured correctly, with the ports released and running the Post normally).

GET

  
    

link (returns 200 OK and the list of users)      link (returns 200 OK and the list of users)

  

PUT

  
    

link (returns 200 OK)      link (returns 405 method not allowed)

  

ClientController: [HttpPut]

    [Route("atualizar/{id}")]

    public ReturnAllServices Atualizar(int id, [FromBody]ClienteModel dados)

    {

        ReturnAllServices retorno = new ReturnAllServices();



        try

        {

            dados.Id = id;

            dados.AtualizarCliente();

            retorno.Result = true;

            retorno.ErrorMessage = string.Empty;



        }

        catch (Exception ex)

        {

            retorno.Result = false;

            retorno.ErrorMessage = "Erro ao registrar cliente" + ex.Message;

        }



        return retorno;





    }

// ClientModel Update.

public void UpdateClient ()

    {

        Conn objConn = new Conn();

        string sql = "UPDATE cliente SET Nome=@nome WHERE id=@id";

        MySqlCommand cmd = new MySqlCommand();



        cmd.CommandText = sql;

        cmd.Parameters.AddWithValue("@nome", Nome);

        cmd.Parameters.AddWithValue("@id", Id);



        objConn.ExecutaQuery(cmd);





    }

I get the following message in postman:

  

405 - The HTTP verb used to access this page is not   allowed.

     

The page you are looking for can not be displayed because it was used   an invalid method (HTTP verb) to attempt access.

Note: I am not using Token because it is a web api on a local server with access to local machines only, the post is working normally ..

    
asked by anonymous 04.09.2018 / 15:11

0 answers