How to resolve error 405 method not allowed on the server?

Asked

Viewed 5,782 times

1

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

When you search for the default document, you get 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 you have the appropriate mime type configure for the requested feature. If the problem persists, contact the 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 http://Server/Web/. The scripted object model (SOUND) is enabled. A DTC event is called.

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

If you can give me a help in the solution, thank you

  • Hello, do you have access to the website web.config? tries to add this within SYSTEM.WEBSERVER <system.webserver> <validation validateIntegratedModeConfiguration="false"/> <modules runAllManagedModulesForAllRequests="true"> <remove name="Webdavmodule"/> <!-- ADD THIS --> </modules>

  • 1

    I closed the other question as duplicate of this, since the answer is already here.

  • @bfavaretto I’ve never seen this before: http://answall.com/posts/107112/edit I wonder what happened?

  • 1

    @For me it is enabled, since I am mod. But the question was blocked by the system because it was closed after I migrated from the goal. This sets up a "rejected migration" and blocks the question.

  • System is very smart and even automated, even knows the "way the question asked", although it should only happen this in some types of closure, still thanks for the clarification !

1 answer

-2


The solution to the problem. I don’t know why when using [Httpdelete], locally it works more when you will use it on a remote server will generates this 405 error.

The solution was changed to [Httppost], the final result of the same, 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);
            }
        }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.