AJAX Call returning 404(Local) in IIS 7.5 but same works in other IIS

后端 未结 4 1808
傲寒
傲寒 2021-01-31 10:39

Am having the AJAX calls to my controller in my MVC Application

Controller/FunctionName



$.ajax({
        type: \"GET\",
        contentType: \"application/jso         


        
4条回答
  •  北海茫月
    2021-01-31 11:20

    What I'd found on my setup of IIS7.5 is that the 'Handler Mapping' has a resource named 'OPTIONSVerbHandler' is not set in the right order hence return back as Unknown.

    This work for me where my localhost ajax was calling my network server, which has a different name, that it shouldn't give me a CORS issue, but it did and this was my solution.

    Open IIS and click on your server name on the left pane. On the right pane double-click 'Handler Mappings' in the middle pane. On the right pane, select 'View Ordered List'. From there find 'OPTIONSVerbHandler' and 'svc-ISAPI-4.0_32bit', move 'OPTIONSVerbHandler' up until it is above 'svc-ISAPI-4.0_32bit'.

    Make sure your 'handler' inside your ajax call does not have 'Access-Control-Allow-Origin' in it.

提交回复
热议问题