WebAPI GET/POST method

Discussion in 'Open Discussion' started by James Lim, Jun 15, 2018.

  1. I have created web API methods using ASP.NET C# with VS2017, and I am calling the methods using AJAX. When I tested them locally, all worked fine. So, I published on Winhost.

    Upon publishing, only the "GET" method (ex: "http://urlroot/pathnames/api/apiname") without any parameter worked but not all others. After doing some search, I have added following on web.config:
    <system.web>
    <trust level="Full" />
    </system.web>

    With this change, other "GET" method required (ex: "http://urlroot/pathnames/api/apiname/{#}") started to work. It was getting security related error message before.

    However, "POST" is not still working I am trying several different things, but keep getting 404 error. Would you be able to provide some insight? Thank you.

    Also, is this "<trust level="Full" />" something that you expect us to use resolve some of the related issues? Or, is there another solution?
     
  2. I got the issue with POST method resolved. directory path had slight mismatch, basically URL was incorrect.

    I still have the question. Does Winhost recommend using "<trust level="Full" />" for method require parameters? Thank you.
     
  3. Elshadriel

    Elshadriel Winhost Staff

    Yes. And if some verbs are not working, you'll need to enable them.
     

Share This Page