Basic concepts of Asp.net (I) differences between web applications and websites

Source: Internet
Author: User

The only advantage of "website" seems to be that it can be dynamically compiled, that is, it is similar to the previous ASP, directly put the source code on the server. In the future, I want to make some minor changes and directly change it on the server, instead of vs for compiling and uploading. However, this also has some disadvantages. The first time you open a website after IIS restarts, you must perform full-site pre-compilation first, which is very slow. Of course, you can also use vs to publish a website, but it seems messy to have a lot of random name DLL in the bin.

Web applications are the same pattern as vs2003. The advantage is that after compilation, it is released. After IIS is restarted, it does not need to be re-compiled. The disadvantage is that each change requires compilation and upload.

Websites support dynamic compilation, which is better than Web applications. The website project can be changed at any time and the results can be viewed at any time, especially when debugging and code modification are the most useful.

Developers develop web applications with clear layers. Web Applications
Fast compilation and easy maintenance. The Web application does not have the app_code folder. Even if you build one on your own, the functions in the website cannot be the same.

A relative path is used to create an ending solution for a web application,
The website is an absolute path. If it is copied to another machine and runs on it, the same address and folder are also required.

WebapplicationAdvantages of the 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.

● Generated assembly
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

● A file can be excluded from the project and source code management.

● Easy support for vsts team build for daily build

● More powerful code check functions, and check policies are controlled by source code

● You can perform prescribed processing before and after compilation

WebsiteAdvantages of the Programming Model:

● Dynamically compile the page to see the effect immediately without compiling the entire site (main advantages)

● Same as above, this can make the error part irrelevant to the part used (it can be required that the part can be checked in only after compilation is passed)

● An assembly can be generated on each page (this method is not generally used)

● A directory can be processed as a web application, and files can be directly copied and published without project files (suitable for small sites)

● You can also compile the page into the assembly (it should not be used, and webapplication can also be implemented through the webdeployment plug-in)

There are also some differences and similarities:


All are designed for Web pages.

You can add ASP. NET folders.

The default. aspx web application displays two original files: default. aspx. CS and default. aspx. Designer. CS.

There is an original file default. aspx. CS.

There are two types of Web applications: re-emergence and release. One web site has only one publishing site.

There is no difference between a web application and a general winform in referencing namespaces;

After the web site is referenced, a bin folder contains DLL and PDB files.

Web applications can be referenced as class libraries, while Web websites cannot be referenced as class libraries.

For Web applications, you can add bin and app_code to the ASP. NET folder. For Web websites, you can add ASP. NET folders, Including bin and app_code.

You can also add components and classes for Web applications, but not for Web websites.

Although the source files are all default. aspx. CS, the Web application has a namespace and an additional system. Collections space reference is provided.

The Web application needs to be re-compiled after the underlying code of the page is modified, and the website does not need to be re-compiled.

You can add APS folders for websites, but not for Web applications.

A dll file is generated for a Web application project.

When the website is released, the DLL file is automatically generated, but the DLL file names are different each time.

Web applications have solutions and project files

The most obvious difference is that you have different deployment methods.


For applications, you only need the DLL files in the page and bin folder.

You also need to deploy the background file of the page

Relatively speaking, large websites are more suitable for Web application projects, while small websites are more suitable for web site projects.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.