views:

1053

answers:

3

Its been a long time since I had to do anything but minor fixes with ASP.NET and I've never deployed a ASP.NET 2.0/3.5 application so probably I'm just missing something simple but I definitely need help.

Basically, we have a poorly written .NET 1.1 web application and we had some contractors come in and break some of our third-party dependencies and update it to a poorly written .NET 3.5 web application (the poorly written part will be addressed later).

So now I'm practicing deployment scenarios on a virtual machine set up like our deployment environment.

  1. I installed the 3.5 framework
  2. I compiled the new code and used visual studio's Build>Publish option as recommended by the contractors to output only the files the application requires.
  3. I copied all the files to a new directory inside of Inetpub on the VM and configured the web.config
  4. I created a new application pool
  5. I created a new IIS website pointed to the new directory and using the new application pool. I configured it to use version 2.0 under the IIS ASP.NET tab

But navigating to the loginpage I get:

Parser Error Message: The file '/View/LoginPage.aspx.cs' does not exist.

Line 1:  <%@ Page Language="C#" MasterPageFile="~/MasterPage/LoginMasperPage.Master" AutoEventWireup="true"
Line 2:      CodeFile="LoginPage.aspx.cs" Inherits="MyApp.View.LoginPage" Title="MyApp - Login Page" %>

What gives? In the .NET 1.1 version of the application all the c# code was compiled into the MyApp.dll and the application knew to look there. Double checking with reflector, all the code is in the binary here too, just the server isn't looking there for it.

What can be going on? I can wait for the contractors to get in tomorrow, or compile everything including the aspx files into the binary, but we have good reasons for keeping the aspx files uncompiled and I'd like to deploy today if possible.

Please note, that this is not ASP.NET MVC, the view namespace/directory is simply where all the webforms are kept

+4  A: 

You have probably used the Web site model for your updated application. Consider using a Web application project instead.

Mehrdad Afshari
Good point, how do I check/change this? Although...wouldn't publish take this into account?
George Mauer
You should create a new Web application project in VS and add the files to it. File -> New *Project* -> ASP.NET Web Application. I'm not sure if VS supports upgrading .NET 1.1 projects to .NET 3.5 just by opening them, but it might do that too.
Mehrdad Afshari
I'm not trying to upgrade anything here, I already have the new code. I'm pretty sure this uses the web app model rather than website, but how do I check this to be certain?
George Mauer
I think it used the Website model. The `CodeFile` attribute in your Page directive makes me think like that. I think you have your sources in App_Code directory. By the way you can precompile your Website model app too.
Mehrdad Afshari
Nevermind...right click on solution and select convert to web application. Now to check if that works...
George Mauer
It did. High five! Lame that Publish doesn't take your model into account
George Mauer
That is really strange because I regularly use the web site option and Publish and never ran into this issue. I wonder if there isn't something set up incorrectly in the files.
metanaito
A: 

In visual studio try this. Click on your web application project. Go to Build > PUblish > Choose the location > click publish. That will build everything and put all the .cs files into a single dll file. It will also leave your html/aspx files in their same locations. This allows you to do what you need to do with the aspx code, while keeping all your cs hidden away.

Nathan Totten
thats what I did - step 2. I appreciate your help, but please re-read what I said I have done.
George Mauer
A: 

Change the CodeFile= reference to CodeBehind= in the "<%@ Page" directive.

Rob King