我正在使用MVC 3与Visual Studio 2010和C#4.0。我的应用程序可以在Visual Studion的IIS Express下正确工作,并且可以部署到远程生产IIS 7.5服务器上。使用IIS 7路由错误与IIS Express生成HTTP 404错误
当我切换到在开发系统上使用完整的IIS 7.5服务器时,我突然开始为我的两个控制器中的操作获取HTTP 404错误。其他控制器功能正常。这是从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 Express和一个部署到IIS。当IIS连接到项目进行调试时,它会引发404错误。
任何人都可以请解释为什么404错误正在生成?
你是否已经设置管理流水线模式以集成到应用程序池中? – levelnis 2013-02-25 12:37:22
谢谢,是的,我们这样做,以及检查“允许32位应用程序” – 2013-02-26 17:08:10
你可以显示这些控制器的路线?行动是否有任何属性?任何自定义处理程序运行? – levelnis 2013-02-26 18:33:00