Route is not being located on my site, but works on localhost

Asked

Viewed 88 times

1

I have a service, with verbs GET and PUT. On localhost is ok, but when I host on my site I get this mistake, only when I call the PUT:

IIS 7.5 Detailed Error - 404.6 - Not Found

According to the guys of the provider, this may be the problem of route not found. See my service and the method that is called by the service.

[RoutePrefix("api/Atualiza")]
public class AtualizaController : ApiController
{
    AutorizadorContext contexto = new AutorizadorContext();
    PedidoLiberacao liberacao = new PedidoLiberacao();

    [Route("{id}/{value}")]
    [AcceptVerbs("Put")]
    public void putItensLiberacao(int id, string value)
    {
        liberacao.AtualizaLiberacao(id, value);
    }
}

The method that is called

[Route("{id}/{value}")]
public void AtualizaLiberacao(int id, string value)
{
    var lista = contexto.Liberacoes
        .Where(l => l.IdOrcamento == id)
        .ToList();

        lista.ForEach(f =>
        {
            f.FlagLiberacao = 0;
            f.AutorizouReceberAtrazado = value;
        });
            contexto.SaveChanges();
}

would be the url like this:

www.meu_site.com.br/authorizer/api/update/1000012120/Testing

  • Is IIS configured correctly with fixed IP? IP meu_site.com.br?

  • This information I do not have, because it is from the Ombudsman(REDEHOST). My site works normally and also the services GET. Only when I’m gonna give one Update in the bank for the service, is what gives the error. According to the technician of the redehost, the PUT method is blocked, I do not know how, but he said it is. They are opening a call to solve and if that is it, this post is solved, problems there and not here.

  • It has to do with your provider if they’re not blocking the PUT calls?

  • Sorry, I wrote without reading your previous comment... Anyway, you know what the problem is.

  • your url is wrong would: http://www.meu_site.com.br/api/atualiza/1000012120/Testando !!!

  • @Virgilionovic, you’re not wrong. Authorizer is the folder on my provider where I host the service, so it would have to be meu_domain/folder/api/update/{id}/{value}. That is correct.

  • @pnet ta wrong then your system! and is not correct because it is giving error 404! do not state this!

  • Well, @Virgilionovic, wrong or wrong, it’s working. The PUT question, I had the information that is blocked by default. Every time you create something on a site, and it’s put in an extra folder, to call yourself I’ve always done so domain/folder/remainder. Works, on localhost works. localhost:port/api/update/id/value, on the site published the service is in a separate folder. I have my website on wwwroot and service in wwwroot/authorizer

  • @pnet sorry, but, that you designed has flaws, it should not be like this, but, it is not because it works that is correct, I just wanted to warn you about this type of development so that you can put in practice a better practice, but, it’s okay if it’s working and you want to stay that way without problems, we’re just here to alert and try to help you, about put you have to release this Webapicors from an internet search is a package to be installed and configured.

  • ... continue looking at the link: https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/enabling-cross-origin-requests-in-web-api

  • Thanks for the tip, @Virgilionovic. The issue of the *URL was the very REDEHOST that guided in this way, when I went to host the service, but now you telling me this, is one more that I will read yes, now and see if solved. What they told me was that the PUT It’s blocked by default, and according to them, they’re watching it for me. But the one you posted, is already something else, which I will be checking already, at this time. Thank you. Just for the record, I was not upset not. It’s just that words, letters, we can’t get through feelings and it seems to be too cold, but cool.

  • @Virgilionovic, I put the CORS and it’s working. redehost told me they were seeing the situation, I don’t know what really solved. However, I read the link and understood that should have the CORS. Please post the comment as a response, I mark your reply, please.

  • In fact Redehost answered me saying that the method is ok PUT

Show 8 more comments
No answers

Browser other questions tagged

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