Rendering Spark Views in a Windows Azure ASP.NET MVC3 Web Application

I created a web application in ASP.NET MVC3 with the Spark 1.5 engine - it works fine on my local development machine, but when hosted on Windows Azure, it cannot find 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 

It seems to me that Spark is not looking for the same folders as WebForms / Razor (with the prefix no ~ / Views), but I can not find where it is configured in Spark.

I tried to add the following to the startup code:

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

... but no change. I can’t help but feel that there is something dazzlingly obvious that I am missing.

+4
source share
1 answer

You do not need to add a provider of the virtual path ~/Views/ , which occurs automatically by agreement, and the above search paths are only the result of two viewing engines (Razor and Spark), which are slightly different from each other. Spark has the root path of the Views view already, when it tells Account\Logon.spark that it is already in the Views folder.

I have the feeling that your spark glances are not actually copied to Azure during packaging and deployment. It is similar to the MVC3 DLL, before they were there, you had to install them to copy locally in order to provide access to Azure.

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

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

Try downloading this package and see if it does the trick?

Hope that helps
Rob

+2
source

Source: https://habr.com/ru/post/1339855/