Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc IIS 7与IIS Express的路由错误生成HTTP 404错误_Asp.net Mvc_Http_Iis 7_Asp.net Mvc Routing - Fatal编程技术网

Asp.net mvc IIS 7与IIS Express的路由错误生成HTTP 404错误

Asp.net mvc IIS 7与IIS Express的路由错误生成HTTP 404错误,asp.net-mvc,http,iis-7,asp.net-mvc-routing,Asp.net Mvc,Http,Iis 7,Asp.net Mvc Routing,我将MVC3与Visual Studio 2010和C#4.0一起使用。我的应用程序在VisualStudion提供的IIS Express下以及部署到远程生产IIS 7.5服务器时可以正常工作 当我切换到在我的开发系统上使用完整的IIS7.5服务器时,我的两个控制器中的操作突然出现了HTTP404错误。其他控制器工作正常。这是从Visual Studio或直接从IIS运行应用程序 我看不出任何配置差异 表现出这种行为的控制器之一是: using System; using System.Col

我将MVC3与Visual Studio 2010和C#4.0一起使用。我的应用程序在VisualStudion提供的IIS Express下以及部署到远程生产IIS 7.5服务器时可以正常工作

当我切换到在我的开发系统上使用完整的IIS7.5服务器时,我的两个控制器中的操作突然出现了HTTP404错误。其他控制器工作正常。这是从Visual Studio或直接从IIS运行应用程序

我看不出任何配置差异

表现出这种行为的控制器之一是:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Configuration;
using Mbrrace.ApplicationServices.Validation;

namespace Mbrrace.WebUI.Areas.Validation.Controllers
{
    public class ValidationController : Controller
    {
        //
        // GET: /Validation/Validation/

        [HttpGet]
        public JsonResult PostcodeCheck([Bind(Prefix = "perinatalView")]AddressViewModel model)
        {

            //  postcode has already been checked for correct format
            //  now look it up to see if it exists

            if (PostcodeChecks.CheckPostcodeExists(ConfigurationManager.ConnectionStrings["CommonCodeEntities"].ConnectionString, model.Postcode))
            {
                return Json(true, JsonRequestBehavior.AllowGet);
            }

            return Json("This postcode was not found in the database", JsonRequestBehavior.AllowGet);

        }

        [HttpPost]
        public JsonResult PostcodeExtendedCheck(String Postcode)
        {

            // check if it exists or of it's sector exists (all but last two characters

            string message = PostcodeChecks.PostcodeExtendedCheck(ConfigurationManager.ConnectionStrings["MbrraceCommonCodeEntities"].ConnectionString,
                Postcode, Postcode.Substring(0, Postcode.Length - 2));
            string success = (message.Length == 0) ? "OK" : "NO";
            var result = new { Success = success, Message = message };

            return Json(result, JsonRequestBehavior.AllowGet);
        }

        public class AddressViewModel
        {
            public string Postcode { get; set; }
        }

    }
}
这与部署到IIS的IIS Express和中的预期行为相同。当IIS连接到项目进行调试时,它抛出404错误


有人能解释一下为什么会产生404错误吗?

我首先想到的是
IIS配置。
在集成模式下配置的站点是否有
应用程序池

您还可以尝试在
global.asax
中添加一个
应用程序\u OnError
并在那里签入
服务器。GetLastError

另一个选择应该是使用“一瞥”来查看您可能遇到的路由问题(如果是路由问题)


在此之后,如果您没有发现问题,请发布有关IIS配置的更多详细信息

您是否已将托管管道模式设置为集成到应用程序池中?谢谢,是的,我们已这样做,并检查了“允许32位应用程序”您是否可以显示这些控制器的路由?动作上有任何属性吗?是否有正在运行的自定义处理程序?您是否已在服务器上安装但未在本地安装?在Express和“常规”web服务器上启用跟踪日志记录,以了解它在Express服务器上的位置和去向,并匹配“常规”web服务器上的进程/路由。某些配置可能不同。非“express”版本具有更多功能,这正在改变行为。