Search code examples
unhandled-exceptioniis-8windows-server-2012

Server Error in '/' Application. Windows Serrver 2012 IIS 8


I received a webpage from a developer and when I try to install it on my fresh installation of Windows Server 2012 with IIS 8 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. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.IO.FileNotFoundException: 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.

I tried to download Windows SDK on my laptop and then copy the gacutil.exe onto the server and run:

C:\tmp>gacutil.exe /I C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.WebPages.Razor.dll

But I still get the same error. Anyone familiar with this?

I am no .NET-developer what so ever. I have no idea what to do. Do I need to install something else on my Windows Server?


Solution

  • You are missing the System.Web.WebPges.Razor file from the bin directory of the web application. Unless that version is installed in the GAC, try putting a copy of it in the bin directory so the application can access it.