Stephen Brannan - 110 - Apr 11, 2014

I’m having trouble deploying ServiceStack with Razor to Azure as a web role. I get the following error…

Could not load file or assembly ‘System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

and it’s referring to this line…
          <add assembly=“System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35” />

But per the Rockstar sample and what’s in my web project is a reference to v3.0.0.0. 

This is mentioned in: 
https://github.com/ServiceStack/ServiceStack/wiki/Razor-Notes

You would need to either change the reference in Razor config to point to the Version=3.0.0.0 or install the 1.0.0.0 version, i.e:
Install-Package Microsoft.AspNet.WebPages -Version 1.0.20105.408

We don’t actually use the library (it’s there just to keep Web.config happy) so it’s cool to use the older 1.0 version.

Stephen Brannan:

I tried to change the reference to 3.0.0.0 in the config and I got the same error but for 3.0.0.0. I then tried to use both the latest and 1.0.20105.408 WebPages nuget package and when I did this the site comes up with the generic “snapshot servicestack” page. It’s as if I lost my razer pages.

Are there any startup errors in ?debug=requestinfo

Stephen Brannan:

What seemed to work both locally and in azure was removing the line <add assembly=“System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35” /> completely from the web.config. I still kept the 3.0 as a reference though. You may want to consider revisiting this situation.

I’ll revert it back to 1.0.2x and try the debug=requestinfo tomorrow and see if anything shows up.

hmm, do you mean this line? 
https://github.com/ServiceStack/ServiceStack/blob/master/NuGet/ServiceStack.Razor/content/web.config.transform#L15

I’ll investigate, it would be damn nice not to specify a specific version.

Stephen Brannan:

Yes that’s the line I removed.