ASP.NET 2.0 application deployment and precompilation issues
I'm going to talk a bit about my first experience deploying a real ASP.NET 2.0 application to a real Windows Server 2003 production web server. It was supposed to be so easy...
We all know that ASP.NET 2.0 comes with new and improved architecture. For example, in a new web project using Visual Studio 2005 we won't see, never ever again, a monolithic dll in our bin folder after building our site like we used to see in 1.x versions. Instead of that, the new 2.0 engine precompiles the web when it's accessed the first time.
Here we have the first issue... I just copied my complete web working folder to my web server, and voila, it worked... but, heeeyyyyy, all my code with full project structure and .cs source files is also uploaded to my server... Actually, even knowing that the ISAPI filter will avoid to download those files, I don't want to place my code on a remote server (I run my own servers, but couldn't just imagine what would happen if uploaded to shared servers)
Of course, those smart guys at Microsoft already thought that I would love to remove my source code from my deployed website and they created the Precompiled Website concept. They provided me with a tool within my Visual Studio 2005 IDE just to publish my site and precompile it, so I've used it to achieve my purpouse with the default parameters.
Uploaded the new precompiled site to my web server... and guess what??? It didn't worked... I started to have HttpExceptions loading types from my "precompiled" site and it just showed an error page stating the type that couldn't be found. Hmmn, I started to think that there was something wrong with my code and lost some time trying to find the missing types and googling for more info about the errors without any success... and finally found a link to an article by Scott Allen talking about the aspnet_compile command line tool
Well, let's try with that tool, I said to myself... Just used the tool with the required parameters and my site was precompiled again... Uploaded it, and guess what??? This time it worked!!!! And my question is... How can two teams be so un-synchronized to develop the same feature working in one place but failing from another?
Tip to myself: until there is no final release, consider this precompilation issue just and issue in the beta software... :-)
And finally, one more annoying thing... the website was using membership, one of the pillars of the new ASP.NET 2.0 model, but when I uploaded the empty databases I could find any option to access the Web Site Administration tool (the same one I have in my Visual Studio 2005) to create a role in my application and assign a default user to that role.
I know it has been removed from Beta 2, but will it be available in the final release of the product? I have no idea.
Anyway, it wasn't that bad... actually it was my first real production deployment, and just paid my newness there.