MVC error in hello world example

Topics: MVC
May 27, 2011 at 9:54 PM

I wanted to try out the MVC player example that is given at http://docs.composite.net/C1/ASP-NET/HelloWorldMVC.aspx/Using-MVC-in-C1#_Creating_an_MVC and I am running into a few difficulties. I have done every single step that is given and when I give the path as /Home to the MVC player I get this error...

Error: The controller for path '/Home' was not found or does not implement IController.
Error details:
Failed to get value for function 'Composite.AspNet.MvcPlayer.Render'
Exception has been thrown by the target of an invocation.
The controller for path '/Home' was not found or does not implement IController.

I am new to MVC programming so I am going through the walkthrough step by step. So far I have completed these steps...

1. Install Visual Studio 2010
2. Update Visual studio 2010
3. Install MVC3
4. Install web matrix
5. Set up a default omnicorp composite site, install the mvc package. Im running c1 version...

Composite C1 2.1.1
Build no. 2.1.4113.99


6. Open project in web matrix and then launch visual studio.
7. Under App_Code->Controllers I created the AjaxController.cs and the HomeController.cs and I copied the code from the tutorial and pasted it in.
8. I created the Views\Ajax and the Views\Home folders and made the Index.aspx and the Index.ascx with the code that was given on the tutorial.
9. I went into the composite admin site to the proper page, chose the mvc function, and set the path to "/Home".

This is where the error shows up. Can somebody please explain what is going on here? Does anybody have a omincorp demo site with some mvc player functionality that I can
download to study?

Developer
May 30, 2011 at 2:05 PM

Hi ldoran

Could you please help me clarify how you have created HomeController.cs and AjaxController.cs? This would help to exclude some scenarios.

1. Have you created those two files in Visual Studio (App_Code > Add an New Item > Class ......)?
2. or Have you copied the ready-to-use HomeController.cs and AjaxController.cs to App_Code via a file manager (Windows Explorer etc)?
3. or Have you uploaded the ready-to-use HomeController.cs and AjaxController.cs to App_Code via the Administrative console (System perspective > /App_Code)?

I am sorry to ask the following question (but because I myself make this mistake from time to time, I'll ask anyway:) ):
Have you created your controllers files in App_Code (and not in App_Data)?

Thank you in advance

Vitaly

 

 

Jul 26, 2011 at 12:17 AM

I am also having this same problem. I am quite familiar with MVC in general and I followed the 'Hello World' tutorial step by step on the composite website.

I was expecting it to be easy but it just displays this error. I have checked all the controllers are in the correct folders and checked the route.cs file too (created them in visual studio).

Any more suggestions?

Jul 26, 2011 at 2:53 AM

Fixed - the problem ended up being a caching related issue. If you delete the ASP.Net temporary files & restart the development web server it will resolve the problem.

(see http://compositec1.codeplex.com/discussions/265023)