部署IIS MVC 4 - 路由失败

时间:2014-05-22 14:46:16

标签: asp.net-mvc iis model-view-controller web-deployment-project

我正在尝试在IIS上部署我的应用程序,但它似乎无法工作。

当我在localhost上运行应用程序时,它没有问题,但是在IIS Web服务器上部署它会遇到一些路由问题。我用firebug检查了它,我看到发送的帖子请求找不到任何目标。

发送的请求:

  

http://xxxxx.com/Customer/CustomerListByFiter?jtStartIndex=0&jtPageSize=10

- >不起作用(找不到页面?)

我的localhost上发送的本地请求:

  

.... / Customer / CustomerListByFiter?jtStartIndex = 0& jtPageSize = 10 - >作品

Customer是我的Controller类,CustomerListByfilter是带有参数的方法......

我做错了什么?

更新

我已经构建了一个示例应用程序,这是部署到Web服务器的代码IIS生成错误(通过Visual Studio运行它可以正常工作):

查看:

   //Prepare jtable plugin
    $('#CustomerTable').jtable({
        title: 'xxx xxx',
        messages: germanMessages, //Localize table
        selecting: true, //Enable selecting
        multiselect: false, //Allow multiple selecting
        selectingCheckboxes: true, //Show checkboxes on first column
        paging: true,
        columnResizable: true, //Actually, no need to set true since it's default
        columnSelectable: true, //Actually, no need to set true since it's default
        saveUserPreferences: true, //Actually, no need to set true since it's default
        //selectOnRowClick: false, //Enable this to only select using checkboxes
        defaultSorting: 'CUST_LASTNAME ASC',
        actions: {
            listAction: '/Home/CustomerListByFiter'
        },

控制器:

    [HttpPost]
    public JsonResult CustomerListByFiter(string name = "", string lastName = "", int   
    cityId = 0, int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
    {
        List<customers> customers = null;
        try
        {
            if (name == "" && lastName == "")
                customers = CustomerList();
            else
            {
                customers = db.customers.Where(c => c.CUST_NAME == name || 
                c.CUST_LASTNAME == lastName).ToList();
            }

            string json = new JavaScriptSerializer().Serialize(Json(new { Result = 
            "OK", Records = customers }, JsonRequestBehavior.AllowGet));
            return Json(new { Result = "OK", Records = customers, TotalRecordCount = customers.Count() }, JsonRequestBehavior.AllowGet);
        }
        catch (Exception ex)
        {
            return Json(new { Result = "ERROR", Message = ex.Message });
        }
    }

我很确定问题是由以下调用产生的:  listAction:&#39; / Home / CustomerListByFiter&#39; - &GT;在本地工作,远程不工作。

系统:IIS 7.5         Windows Server 2008 R2 部署为应用程序

0 个答案:

没有答案