20 Feb 2012 - Digital Strategy // By Productive Edge Team

Error – Exception has been thrown by the target of an invocation.

I have recently been working with Umbraco 5 (Jupiter), the newest version rebuilt from the ground up using ASP.NET MVC. One of the stranger issues that I ran into occurred after adding a Surface Controller, and a corresponding custom View to the pre-compiled site. The following error showed up after a build/save all:


The pre-application start initialization method Start on type System.Web.WebPages.Deployment.PreApplicationStartCode threw an exception with the following error message: Exception has been thrown by the target of an invocation.

Since I opened the site up as an ASP.NET MVC3 Web Site, adding the view added the following to the Web.config:

<add key="webpages:Enabled" value="true" />

Since it does this behind the scenes, I was confused about how the error started, and wasn't able to catch it until doing a compare on a fresh Umbraco web.config, and the one that was in the project root. Hopefully this saves some of you some time

Share
Error – Exception has been thrown by the target of an invocation.