Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

POST and PUT methods are not working #5184


User avatar
0
vrpatlola created

Hi, Created some POST and PUT methods those are working properly on local environment but that is not working when we deployed on production GET methods are working properly, but while PUT and POST getting 405 (Method Not Allowed) error

also getting , No 'Access-Control-Allow-Origin' after above error even CorsOrigins is configured properly in appsetting.json

Please help!

Thank you! Prashant


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team
  • User Avatar
    0
    alper created
    Support Team

    So the PUT and POST methods are not implemented correctly. I guess you are talking about your Application Services... If so you can use HTTP method attributes on your interface methods.

    public interface ITaskAppService : IApplicationService
    {
        [HttpGet]
        GetTasksOutput GetTasks(GetTasksInput input);
    
        [HttpPut]
        void UpdateTask(UpdateTaskInput input);
    
        [HttpPost]
        void CreateTask(CreateTaskInput input);
    }
    

    <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Dynamic-Web-API#http-attributes">https://aspnetboilerplate.com/Pages/Doc ... attributes</a>

  • User Avatar
    0
    vrpatlola created

    Able to resolved this issue by adding following lines in web.config

    <modules runAllManagedModulesForAllRequests="true"> <remove name="WebDAVModule"/> </modules>

    Thank you All! Prashant

  • User Avatar
    0
    alper created
    Support Team

    thanks for your feedback. ;)