0
votes

I've written a web application with ASP.NET MVC. The default ControllerFactory has been replaced with Castle Windsor's Controller

ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory());

The problem is that I'm using shared hosting which runs II6 so in order to get the MVC working I've had to replace the default MapRoute with

        routes.MapRoute(
            "Default",
            "{controller}.aspx/{action}/{id}",
            new { controller = "Home", action = "Index", id = "" }
        );

[ NOTE THE: {controller}.aspx ]

When I upload a newly created "ASP.NET MVC Web Application" with this modified MapRoute it works fine ... but when I upload my MVC Web Application (that uses the Castle Windsor) I get the following error in my browser:

URL[ http://10.0.0.9/LoseOnlyToday/Home.aspx ]


Server Error in '/LoseOnlyToday' Application. The IControllerFactory 'WebUI.WindsorControllerFactory' did not return a controller for a controller named 'Home.aspx'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The IControllerFactory 'WebUI.WindsorControllerFactory' did not return a controller for a controller named 'Home.aspx'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: The IControllerFactory 'WebUI.WindsorControllerFactory' did not return a controller for a controller named 'Home.aspx'.] System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +304 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +54 System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053


I assume Castle Windsor does not like interpreting "Home.aspx" as the controller ...

How can I fix this ?

1

1 Answers

0
votes

Ok so I found out why its not working ... when you I uploaded the website files originally I uploaded everything - but after making some changes I only uploaded the "Global.asax" and "Global.asax.cs". The thing is the .cs files should not even be uploaded ... the project gets compiled and stored in the bin folder as ".dll" and its this file that must be uploaded for the changes to take effect ...