Question

I've built a web application in ASP.NET MVC3 with Spark 1.5 view engine - works fine running on my local development machine, but when hosted on Windows Azure it can't find the Spark Views. I get the following standard error screen:

The view 'Logon' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Account/Logon.aspx
~/Views/Account/Logon.ascx
~/Views/Shared/Logon.aspx
~/Views/Shared/Logon.ascx
~/Views/Account/Logon.cshtml
~/Views/Account/Logon.vbhtml
~/Views/Shared/Logon.cshtml
~/Views/Shared/Logon.vbhtml
Account\Logon.spark
Shared\Logon.spark

Seems to me that Spark is not searching the same folders as WebForms/Razor (since no ~/Views prefix), but I can't find where this is configured in Spark.

I've tried adding the following to the startup code:

settings.AddViewFolder( ViewFolderType.VirtualPathProvider,new Dictionary<string, string> { { "virtualBaseDir", "~/Views/" } } );

...but no change. Can't help feeling there's something blindingly obvious I'm missing.

Was it helpful?

Solution

You shouldn't need to add a ~/Views/ virtual path provider, that happens automatically by convention and the search paths above are just the output of the two view engines (Razor and Spark) differing slightly. Spark has a root view path of Views already it when it says Account\Logon.spark it is already in the Views folder.

I have a feeling that your spark views are not actually getting copied up to Azure when you package and deploy. It's similar to the MVC3 dlls before they were up there, you had to set them to copy locally to ensure Azure had access to them.

If you rename the Azure package to a .zip file and open it up to see if the views have been included as part of the content. If not, then try highlight one of the Spark files in Solution Explorer and check the Properties. Set the Copy to Output Directory to Copy Always and build and repackage your Azure project.

Your local bin folder in the project should also now have a Views Folder with the Spark views contained for verification.

Try and upload that package and see if it does the trick?

Hope that helps,
Rob

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top