1

I have a production system and test system, both running IIS. IN the production system, everything runs fine. In the test system, I have a directed copy of the folder the site code is contained in which is set up as a virtual directory. The App_Code folder is in the root and contains all the .cs files. When running the same site in test, I get a

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'SPTasks.master'.

Source Error: 


Line 1:  <%@ Master Language="C#" inherits="SPTasks.master"%>
Line 2:  <html> 
Line 3:  <head runat="server">


Source File: /SPTasks/master.master    Line: 1

Any idea why this would be coming in test and not in production? Is the code not compiling for some reason?

Thanks!

steventnorris
  • 5,656
  • 23
  • 93
  • 174
  • Are these different machines? Have you checked the framework in the application pool? Is e.g. `Mvc` installed? – Silvermind May 02 '13 at 18:20
  • They are different machines. They are both using ASP.NET Framework 2.0 with the 3.5 additions installed. I'm not sure about MVC specifically. Is there a quick way to check that in IIS7.5? – steventnorris May 02 '13 at 18:21
  • @Silvermind Depending on the version of MVC, hopefully 3+, you shouldn't need to install it locally on the server. It should run entirely from the application's bin folder. – Devin Goble May 02 '13 at 18:22
  • @steventnorris kettch is right about installing `Mvc`, but it was merely a question of dependency requirement. Check this question it this applies. [Do I need to install MVC 3/4 on web server to run mvc application](http://stackoverflow.com/questions/10441568/do-i-need-to-install-mvc-3-4-on-web-server-to-run-mvc-application) – Silvermind May 02 '13 at 18:27
  • Well, I'm not using Visual Studio to create these files, so the deployable dependency is out. I'm creating the files and folder structure on a file by file basis. – steventnorris May 02 '13 at 18:29
  • I suppose then it's a matter of researching the dependencies that are required and wiring them up. Visual Studio obviously handles that all in the background. Is there a reason you can't at least built the basic project with VS? – Devin Goble May 02 '13 at 18:52
  • @kettch I'm attempting to directly mirror a production site. I am literally copying the folder structure over, in its entirety, into my test environment to make small changes. – steventnorris May 03 '13 at 11:56

2 Answers2

1

Some of the comments have asked about MVC, but this looks like a WebForms application - correct me if I'm wrong? In the past I've seen this error if the application has not yet been compiled. You mention that you're copying files across one at a time. Have you actually compiled the application? If there's no dll in the bin folder containing the compiled code for your SPTasks.master.cs class, you'll get this error. As you're not using VS to compile your application, you'll need to use csc directly from the command line as per this MSDN article.

If you have a dll in there, it might be worth looking inside with a decompiler (either Reflector or Jetbrains DotPeek, which is free) to verify that the SPTasks.master.cs class is there.

Another thing to check is that the application pool that the site is running under is configured as .Net Framework Version 2.0 and not 4.0

levelnis
  • 7,665
  • 6
  • 37
  • 61
  • I'm thinking it's a compile issue as well. As I understand it, the code in App_Code should be compiled (if it isn't already) at first run of the site application. So the first time I navigate to the site, it should compile the code. I've never had to compile via command line with our production environment. – steventnorris May 03 '13 at 11:53
  • I've done some checking, you are correct. The code is not compiling. However, I should not have to compile the code into a bin folder for it to work. It compiles at first run, as stated here under "Automatic Compilation": http://msdn.microsoft.com/en-us/library/ms178466(v=VS.100).aspx – steventnorris May 03 '13 at 14:12
  • Sounds like you have things set up following the websites model as opposed to the web application model. Maybe you have a setting relating to [dynamic compilation](http://msdn.microsoft.com/library/ms366723) missing or set incorrectly? – levelnis May 03 '13 at 14:36
  • I'ver heard of the websites vs web app model. I'm not sure where to ensure dynamic compilation settings though. I've always just copied my folder over, but IIS7.5 seems to not have the setting prepared for dynamic compilation. (It's all code that doesn't compile, not jsut this one file. I checked) Where would I find those settings? – steventnorris May 03 '13 at 14:39
  • It's all in the [compilation](http://msdn.microsoft.com/en-us/library/s10awwz0(v=vs.100).aspx) section of `Web.config` – levelnis May 03 '13 at 14:49
  • Ah, I don't have a Web.config in the virtual directory. Never have. It's always worked without one fine. – steventnorris May 03 '13 at 14:55
  • Curiouser and curiouser. Here's a link to [Websites vs Web Apps](http://stackoverflow.com/questions/398037/asp-net-web-site-or-asp-net-web-application) – levelnis May 03 '13 at 14:56
  • You need a config file to run a website but they work on an inheritance hierarchy. Could there be a web.config file in a parent directly on production that isn't in the test environment? Or settings in machine.config that are different? – levelnis May 03 '13 at 15:03
  • There are no web.config files, so it must be inheriting from machine.config. Where would I go about finding that file to check the config between the two? – steventnorris May 03 '13 at 15:06
  • It's part of the framework code so will be in a directory similar to C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG – levelnis May 03 '13 at 15:10
  • I've looked through both the machine.config and the web.config in that folder, paying particular attention to sections on compilation. They don't look any different to me. – steventnorris May 03 '13 at 15:13
  • And presumably there's no `.csproj` file in the root of the application either? If there is, compare those as well. I'm honestly at a loss I'm afraid Steven. Need to head home now but if I think of anything else I'll post again – levelnis May 03 '13 at 15:16
  • Thanks for all your help. This one has me stumped as well. – steventnorris May 03 '13 at 15:26
0

Your IIS website is probably misconfigured. An IIS "virtual directory" is not the same thing as an application scope.

In IIS Manager, right-click the root of your application and choose "Convert to Application".

Dai
  • 141,631
  • 28
  • 261
  • 374
  • Virtual directories are how the production environment works, and the test environment needs to fully mirror production. – steventnorris May 03 '13 at 11:51