How to Update Remote Web Server with New Code-behind files

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I work on a development server (Server A), and have a staging server (Server
B), where updated ASP.Net files from Server A are sent to. I noticed that
Server B will reflect changes made to .aspx files just by copying the new
files from Server A.

Server B only has the framework installed, and the project folder structure
is enormous (100MB+). I know that I can rebuild the project on Server A,
which has .Net Studio, and copy the new project to Server B, but this would
take a very long time for each instance a code-behind file is updated.We
tried restarting IIS each time a code-behind file is updated, but the
changes are still not reflected.

What is the best way to copy code-behind files (c#) to Server B, and have
the changes reflected?

Does this have to do with the "debug" attribute in the web.config file?
Server A has it set to "true" <compilation debug="true"/>, and Server B has
it set to "false" to improve performance.

Thanks,
Chris
 
You need to recompile your project, and send the new DLL for the project
over to the other server. If you don't change any code in the codebehind,
but just the front end UI, then you can copy just the .aspx over.

The codebehind class is just text. It's the dll that has compiled executable
code based on this text that is actually needed.
 
CodeBehind source files do not need to be there in production, provided you
have compiled all of them into an assembly dll. (which is stored in the /bin
folder of your applications root). Infact the CodeBehind keyword in the
@Page directive is completely ignored by asp.net. (It's only a visual studio
attribute). You can get around this if you replace
CodeBehind="blah.aspx.cs" with src="blah.aspx.cs", but then it will be
compiled by the JIT compiler when the page is requested.

If this is not the issue and you actually want the codebehind files on
your second server, you can either use xcopy deployment, or "copy project"
from the project menu.

HTH,
--Michael
 
So all that's needed on Server B is to overwrite the existing
bin\projectname.dll with the updated one from Server A?

Great.
Thanks
 
so easy isn't it :)

Chris said:
So all that's needed on Server B is to overwrite the existing
bin\projectname.dll with the updated one from Server A?

Great.
Thanks
 
Back
Top