Web site vs web application in Visual Studio
Rob Conery got me thinking about web site maintenance and I put forward a brief comment on the two distinct types and how Visual Studio handles them which I have expanded upon here.
Primarily for working with ad-hoc web sites that have programmed elements. Easily identified by customer-specific content present in aspx files.
No solution or project files are required and the pages and source can reside locally (file system, IIS) or remotely (FTP, WebDev/FrontPage extensions) via the File > Open > Web Site… menu option.
Code-behind and classes are typically stored on the web server which compiles them in-memory on demand. Changes can be made to the files without restarting the application and losing sessions.
|Quick edit, test, deploy cycle||Syntax errors at runtime|
|No need to compile or restart app||Can’t create an installer|
|Source always available||Source on server useful to hackers|
Web application projects were introduced as an add-on for Visual Studio 2005, later rolled in to VS 2005 SP1 and made a full first-class citizen with Visual Studio 2008.
Like the name implies these are primarily for web applications, those times when you have written a product or solution that happens to have a web interface.
Web application projects exist on your local drive and are treated like any other VS project type and can be added to existing solutions are subject to full compilation, validation and build steps.
Deployment is typically via MSI installers however you can also utilise the addition Web Deployment Projects add-in which allows you to deployment directly to servers which is useful for deploying to test environments.
|Controlled build & deploy process||Deployment causes application restart|
|No class files on web server, dll only||Can’t deploy individual classes|
|Syntax errors at compile time|
Sander and I were discussing this article and thought an interesting solution might be to use the Web Application model for local development but to use the Publish option to publish all solution files to an intermediate directory.
Then in the intermediate directory just remove the bin/applicationname.dll file and copy to the target. This should prevent an application restart unless the web.config or global.asax/global.asax.vb files have been modified.