Scenario
WEB Application Project
Web Site Project
Project definition
similar to Visual Studio. NET 2003, because the project file exists, only the files referenced by the project file will appear in the Solution Explorer. And only these files will be compiled. Can easily put an ASP. NET application is split into multiple Visual studio projects. It is easy to exclude a file from the project and source code control.
A directory structure is a Web project. No project file exists. All files in this directory are present as part of the project.
We actually deploy a Web site, on the deployment of course there will not be any project files exist, if you want to modify this site, with this programming model is very suitable. We don't have to care about which project the files belong to in this web site.
Compiling and building
is almost the same as the Web Application project compilation pattern for Visual Studio. NET 2003.
All Code-behind and standalone class files in the project are compiled into a standalone application set. This application set is placed in the bin directory. Because it is a standalone application set, you can specify the name of the application set, the version, the output location, and so on.
For example: Themodel-view-controller (MVC) pattern can be used very well here. Because it allows a separate class to be referenced in Web pages and Web user controls.
The buildcommand simply tests that the Web site is compiled correctly, and when debugging a Web site project, it is done by relying on your source code files, which aredynamically compiled by ASP.
Precompiled sites and dynamically compiled sites use the same compilation semantics, which you can precompile to improve the performance of your site.
The ASP. NET Dynamic compilation system provides two models: the default batch compilation model and the fixed-names compilation model.
In the batch compilation model, it is compiled into multiple application sets (typically, each directory is compiled into one). At this point you look at the application set and it is difficult to correspond to which directory.
In the Fixed-names compilation model, each page of the site or each user control is compiled into an application set.
Development experience
When you debug or run a Web page, you must compile the entire Web project.
Compiling an entire Web project is usually faster because Visual Studio uses the incremental compilation mode, which is only incrementally compiled when the file is modified.
You can configure the compilation properties of Visual Studio 2005: Compile the entire site, compile a specified page, or do nothing. In the last case, when you run a Web site,Visual Studio opens only one browser and accesses the current or start page, and when the request is sent,ASP. NET starts the dynamic compilation.
In this mode, the page is dynamically compiled or compiled into different application sets, so if you debug or run a page, you don't need the entire project to be compiled. The parts that are wrong and the ones you use are not interfering with each other.
By default, when you run or debug any Web page,Visual Studio compiles the Web site project completely.
Doing so can see all the errors at compile time. However, in the development process, full compilation of the entire site can be quite slow. So it is recommended that you compile only the current page in development debugging.
Deployment
Because all class files are compiled into an application set, when you deploy it, you only need to deploy the application set along with the . aspx file, the. ascx file, and other static content files.
Under this model, the. aspx file will not be compiled and will be dynamically compiled when the browser accesses the page.
However, if you use the Web Deployment Projects (a Visual Studio 2005 plugin that is not included by default in VS2005 ), you can put the . aspx The file is also compiled into an application set.
If you modify only a small line of code, you also need to compile all the code for the entire project, and publish the application set that contains all the code.
Using Visual Studio's Publish Website command, you can compile the. aspx file and the Code-behind file into an application set, so you see the compiled . The aspx file header has changed. (Note: TheBuild command does not give you an application set that you can deploy.)
The latest version of Publish will support compiling only the Code-behind file, so that when deployed, the . aspx file will not be changed.
By default, it is precompiled into several application sets in the Bin directory, typically a directory corresponding to an application set.
The Fixed-names deployment option lets you create an application set for each Web page or per Web user control so that each page has a deployable set of applications. However, thefixed-names deployment option increases the number of application sets, and the actual memory usage increases.
upgrading from Visual Studio. NET 2003
Because the same Web project development model is used with VS2003, the upgrade is very, very simple.
The different compilation options for the WEB site project cause it to differ greatly from the Visual Studio. NET 2003WEB Project.
Although Microsoft provides a conversion wizard, if your project is a complex VS2003 project, you will need to do a lot of work with the conversion manual after using this conversion wizard.
If you are upgrading from VS2003, it is recommended that you do not develop a template with this Web site. Instead, use the WEB application project.
Comparison of Web application and Web site two templates