jquery ajax call to JsonResult controller method results in 404 on IIS6

后端 未结 2 896
我寻月下人不归
我寻月下人不归 2021-01-13 14:42

I\'ve been pulling my hair out this morning trying to figure this out.

I have a simple jquery json request to a jsonresult action on my controller. When I run this o

相关标签:
2条回答
  • 2021-01-13 14:47

    For extensionless urls in IIS 6 you need a wildcard mapping. Read this blog post for more details on setting this up.

    0 讨论(0)
  • 2021-01-13 15:14

    Alright, I figured it out with the help from another SO post.

    The problem was with the URL being passed. It's obviously different from my machine, and the server I deployed to. I'm embarrassed that I didn't think about this.

    I changed the $.ajax call from this:

    url: "/Customer/GetCityStateFromZip"
    

    To this, which is using Url.Action to the correct full path:

    var url = '<%= Url.Action("GetCityStateFromZip","Customer") %>';
    url: url 
    

    And all is well.

    0 讨论(0)
提交回复
热议问题