I am using MVC 3 with Visual Studio 2010 and C # 4.0. My application runs correctly on Visual Studion's IIS Express and when deployed to a remote IIS 7.5 server.
When I switch to using the full IIS 7.5 server in my development system, I suddenly started getting HTTP 404 errors for actions on my two controllers. Other controllers function correctly. This is either launching the application from Visual Studio, or directly from IIS.
I see no differences in configuration.
One of the controllers exhibiting this behavior:
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
{
[HttpGet]
public JsonResult PostcodeCheck([Bind(Prefix = "perinatalView")]AddressViewModel model)
{
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)
{
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; }
}
}
}
It behaves as expected in IIS Express and is deployed in IIS. It throws error 404 when IIS is connected to the project for debugging.
Can anyone shed some light on why 404 errors are generated?