Error returning View to Dashboard gadget


I'm developing a dashboardgadget for EPiServer 7 but have run in to problems when trying to return a list to the default View (Index) as described in: 

Returning content works fine: 

return Content("Test");

but when trying for exampel:

return View(myList);

The dashboard gadget only displays: "Sorry, an error occurred". The problem remains the same trying any type of combination of returning empty Views, typed View vs. non-typed View etc. Any ideas?


Nov 07, 2013 11:23

Do you get any 500 error message back from the server? (usually there is an error in the view). Try running it with the console open or using a proxy tool like Fiddler.


Nov 07, 2013 11:56

I'm getting these errors in the console:

A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll
A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll
A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll
A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.dll
A first chance exception of type 'Microsoft.Samples.Runtime.Remoting.Channels.Pipe.PipeIOException' occurred in EPiServer.Scheduler.dll
The thread 'PipeServerChannel.ServerMain' (0x674) has exited with code 0 (0x0).

No 500 error as far as I can see. 

I've tried to strip the View so currently nothing is going on there. But the error still occurs...

EDIT: There's actually an 500 error and it seems that it can find the view (Index). I created it as a partial view as described in the article I linked in my intial post. But maybe there's something wrong there anyway...:)


Edited, Nov 07, 2013 12:43

Could you double-check using Fiddler? In my experience Chrome's console window doesn't always show all errors (while Firefox's is better).

You could also enable compilation of your views during build to see if you get any build errors.


Nov 07, 2013 12:48

Did the double-check just now (updated my previous reply)... :)

Nov 07, 2013 12:51

Ok, great. You should be able to see the stack trace in the 500 response. Good luck.


Nov 07, 2013 12:53

Yes! Thanks for the help so far :)


Nov 07, 2013 12:56

Hmmm this obiously goes beyond my understanding. This is the exception:

Exception Details: System.InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:

  The View IS in ~/Views/SocialMediaStats/Index.ascx. Setting the build action for the View to "Embedded Resource" doesn't help.

Nov 07, 2013 13:17

Do you have a viewstart.cshtml defined somewhere? Try adding:

    Layout = null;

To your view.


Nov 07, 2013 13:29

Ok. some steps forward :)

As described in the article I created a separate project for my Dashboard gadget and pointed the location for this project to: MyWebsiteFolder\Public. Building and running still gives the error described above. BUT! If I manually copy(!) my View (MyWebsiteFolder\Public\Views\SocialMediaStats\Index.cshtml) to MyWebsiteFolder\Views\SocialMediaStats\Index.cshtml everything runs OK.

However, I presume that this can not be the preffered way of doing this? Am I missing some step or have I misinterpreted the instructions given in the article?


Edited, Nov 07, 2013 17:02
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.