How to solve the 405 error method not allowed on the server? [closed]

0

I developed a web api, upload on the server is all methods the only one that does not work is the delete, I did a search on the internet is to find out:

When you search for the default document, you receive one of the following error messages: HTTP Error The method specified in the request line is not allowed for the resource identified by the request. Make sure that you have the appropriate MIME type configure for the requested resource. If the problem persists, contact your server administrator. HTTP 405 - resource not allowed Internet Information Services This problem occurs if the following conditions are true: You do not specify the file name. For example, you do not specify link . The Script Object Model (SOM) is enabled. A DTC event is called.

On the local machine everything works, only the server is not working.

If you can help me with the solution, thank you

    
asked by anonymous 07.01.2016 / 17:53

1 answer

-1

The solution to the problem. I do not know why when using [HttpDelete], locally it works more when you are going to use this on a remote server it will generates this 405 error.

The solution has been changed to [HttpPost], the end result of it is now working.

        [HttpPost]
        [Route("deletar/jogo/{nJogo}/{idusuario}")]
        public HttpResponseMessage Deletar(int nJogo, int idusuario)
        {
            try
            {
                var tTabela = new JogoDetalheAplicacao();
                tTabela.Excluir(nJogo, idusuario);
                return Request.CreateResponse(HttpStatusCode.OK, "Cadastro excluido.");
            }
            catch (Exception ex)
            {

                return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
            }
        }
    
07.01.2016 / 19:56