[Go to] Asp.net's webapplication (Web application) and website (website)
Web application is a new Web mode in the SP1 extension package appended by Ms after vs2005 is released. During webapplication compilationCodeCheck, do not need to do analysis, these tasks are handed over to the runtime. The advantage of website is that a single page can be compiled independently, which is a great advantage for large projects. The intuitive difference between the two is that for each ASPX page file, webapplication also has a designer while having the corresponding CS file. the CS file is Baidu.
Advantages of the webapplication programming model:
● The website Compilation speed is fast and the incremental compilation mode is used. This part will be incrementally compiled only after the file is modified.
● GeneratedProgramSet
Website: generate a random Assembly name. You must use the plug-in webdeployment to generate a single assembly.
Webapplication: You can specify a website project to generate a single assembly. Because it is an independent assembly, you can specify the name, version, output location, and other information of the application assembly like other projects.
● The website can be split into multiple projects for convenient management
● It can be in and out of the projectSource codeExclude a file from management
● Support for vsts team build to facilitate daily building
● More powerful code check functions, and check policies are controlled by source code
● You can perform prescribed processing before and after compilation
● Strong resource class support for app_globalresources
● Directly upgrade a large system built using vs2003
Advantages of the website programming model:
● Dynamically compile the page to see the effect immediately without compiling the entire site (main advantages)
● Same as above, which can make the error part irrelevant to the used part
● An assembly can be generated on each page.
● A directory can be processed as a web application, and files can be directly copied and published without project files
● You can also compile the page into a set of programs.
Mutual conversion between the two programming models:
Vs2005 SP1 has a built-in Conversion Program, which can easily switch from website to webapplication by copying files and right-clicking and executing "convert to Web application.
In short, large websites are more suitable for webapplication projects, while small websites are more suitable for website projects.
The following table lists the important differences between web application and web site.
|
Situation |
Web Application Project |
Web Site Project |
|
Project Definition
|
Only files referenced in the Web application solution are part of the project. These files are also displayed in Solution Explorer and compiled during generation. Due to the existence of project files, some solutions are easier to implement. For example, you can divide an ASP. NET application into multiple Visual Studio projects. Files can also be easily excluded from the project and source code. |
The web site uses the document structure to manage project files. It does not include project files. All files in the folder are part of the project.
Applicable to the existing website directories that do not contain item files.
|
|
Compile and generate output |
All program code files and independent files in the project are compiled into an assembly and saved in the bin folder. You can specify the Assembly name, version, output location, and other information. |
When a command is generated in a web site project, the Assembly is not generated, but the web site is verified. When running the web site, the pages and class source files are dynamically compiled and deployed by Asp.net.
At the same time, you can also pre-compile the site to improve performance. In the pre-compilation, the same technology as dynamic compilation is used.
Asp.net pre-compilation has 2 medium mode. batch mode (the default) and fixed-names mode. batch mode to generate an assembly. Fixed mode on each page, the user control generates an independent assembly. |
|
Development
|
You need to compile the entire project before running and debugging the program, but the web application Compilation speed is usually very fast, because the incremental compilation mode is used, only after the file is modified, this part will be incrementally compiled. |
Because dynamic compilation is used and compiled to different sets, you do not need to compile the entire project successfully when accessing or debugging a specific page.
The Generation Command will verify the entire project, but the speed is slow. Therefore, we recommend that you compile the current page only during development and debugging. |
|
Deployment |
Because all the code files are generated as an assembly, you only need to deploy the page files such as the Assembly and. aspx to the server.
The. aspx file is compiled only when it is accessed by the browser.
Every time an assembly is updated, all Page code is replaced. |
You can use the publish command to compile both the. aspx file and the background code file into the Assembly. If you select updateable publish option, you only need to compile the background code.
The default mode will generate an assembly for each folder. The fixed name mode will generate an assembly for each page, but it may cause extra burden on the storage space. |
|
Upgrade from Visual Studio. NET 2003 |
As it works in the same way as. NET 2003, there is basically no need for too many operations. |
You need to use the Upgrade Wizard and some additional operations. |