Reputation: 1580
I'm getting this error when I try to use access an ASP.NET MVC3 application using the Spark View Engine published to my local IIS 7 server. I've looked at this answer and have already followed that advice, but I still get problems. I also tried changing the Copy Local setting to true for the Microsoft.Web.Mvc DLL. I never get this error with the Visual Studio debug server. Republishing sometimes makes the error go away, but it comes back.
Where should I start looking to get rid of this problem?
Thanks!
<!-- At the end of my Web.config: -->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
edit: For clarity, the IIS server that I'm trying to deploy to is on my development machine.
edit: My _global.spark looks something like this:
<use namespace="System.Collections.Generic"/>
<use namespace="System.Web.Mvc.Html"/>
<use namespace="System.Web.Mvc"/>
<use namespace="System" />
<use namespace="System.Linq" />
<use namespace="Namespace.For.Some.Code" />
<use namespace="Namespace.For.Some.More.Code" />
<use namespace="Namespace.For.Yet.Some.More.Code" />
<use namespace="Microsoft.Web.Mvc" />
<use namespace="Namespace.For.Still.More.Code" />
<!-- Added after suggested answer -->
<use assembly="Microsoft.Web.Mvc"/>
<global type="string" Title="'title of my app'" />
<global type="SomeDomainObject" SomeVariable="Utilities.ApplicationUtilities.GetSomeDomainObject" />
Upvotes: 3
Views: 991
Reputation: 8685
Have you referenced MVC from your /Shared/_global.spark
file?
You can see the details in this answer
Alternatively you can add the namespaces to your SparkSettings
when you register the ViewEngine. This is what mine looks like:
var settings = new SparkSettings()
.SetDebug(true)
.SetAutomaticEncoding(true)
.AddAssembly("Web")
.AddNamespace("Web.Model")
.AddNamespace("System.Collections.Generic")
.AddNamespace("System.Linq")
.AddNamespace("System.Web.Mvc")
.AddNamespace("System.Web.Mvc.Html");
Hope that helps,
Rob
Upvotes: 1