I’m trying to deploy a MVC3 app into an IIS6 environment into a sub folder of an existing 2.0 site. The problem I have is that none of the actions are able to hit the controller now I have relocated the application to a subfolder. The controller name is SurveyController and the subdirectory name is Survey.
this is where things go wrong
$.ajax({
url: '@Url.Action("AddSurvey")',
type: 'GET',
async: false,
contentType: 'application/json',
success: function (result) {
ko.applyBindings(new ViewModel(result));
}
});
Now that I’ve moved into a subfolder what do I need to do to ensure controller actions are routed correctly?
Currently registered routes are
RouteTable.Routes.MapRoute("", "", new { controller = "Survey", action = "Index" });
Edit:
After a few more tests. I am able to browse to a controller that creates an simple hello string. But as soon as I introduce the EF DBContext it throws an error saying
“The IControllerFactory ‘UI.Infrastructure.NinjectControllerFactory’ did not return a controller for the name ‘MyTest’. “
public ActionResult MyTest()
{
ContentResult cr = new ContentResult();
cr.Content = "hello";
return cr;
}
but not
public ActionResult MyTest()
{
RolloverModel ctx = new RolloverModel("name=MyModel");
cr.Content = ctx.Connection.ConnectionString;
return cr;
}
Thanks in advance!
I don’t know what rellocation you did, but the AJAX example you have shown cannot possibly work because you are using the GET verb with
contentType: 'application/json'which is not supported by the model binder.