"Go" VS2010 the difference between a new Web site and a new Web application

Source: Internet
Author: User
Tags visual studio 2010

In Visual Studio 2010, in addition to building your own Web project in a way that creates a Web application, you can build Web sites by creating a Web site
Where the Web site is created: Open the Visual Studio 2010 main form, and in the menu bar, choose File | New | Site command, in the new Web site form that pops up, you can create your own web site from both the ASP. NET site and empty site templates. How to create a Web application: Open the Visual Studio 2010 main form, and in the menu bar, choose File | New | Project command, in the new Project form that pops up, you can use the web| The ASP. NET Web application creates its own Web application.

They exist in the following differences:

1. From the perspective of the overall structure
There is no difference between a Web application and a generic WinForm program, which is managed by project and only the files referenced by the project file will appear in the Solution Explorer, and only those files will be compiled. It is easy to split an ASP. NET application into multiple Visual Studio projects, or you can easily exclude a file from project and source code control. While project files are managed by namespace, Web applications can easily reference other class libraries, and themselves can be referenced as class libraries, making it ideal for project sub-templates to be developed. As a result, it is thought that the Web application might be Microsoft's reservation to allow programmers to transition from WinForm to web development well. Each Web page has three files:. aspx,. aspx.design.cs,.aspx.cs files, and each page has a namespace.

Compared to Web applications, Web sites take on a new development structure, a directory structure is a Web project (without creating a project file, you can open the folder directly in studio), and all the files in this directory exist as part of the project. Web sites cannot be referenced as class libraries. Each Web page has two files:. aspx,. aspx.cs file, which discards the concept of namespaces, and each page does not have a namespace.

2. From the compilation deployment look
When you debug or run a Web application 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. Because all class files are compiled into an application set, you only need to deploy this application set with. aspx files,. ascx files, configuration files, and other static content files when you deploy. Under this model, the. aspx file will not be compiled and will be dynamically compiled when the browser accesses the page.

All of the Code-behind and standalone class files in the Web site project are compiled into a separate application set that 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. By default, when you run or debug any Web page, Visual Studio compiles the Web site project completely, which lets you 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.

If you have the following requirements for development, it is recommended that you build your own Web project using the way you create your Web application:
In order to manage the project, you need to use multiple projects to build a Web application that splits a large ASP. NET project into multiple small projects.

You need to use a separate class in a Web page or Web user control on development, and you want to use a namespace to manage it, and to control the name of the application set after compilation.

        If you have the following requirements for development, it is recommended that you build your Web project by creating a Web site:
        like to use Single-page the code model to develop site pages instead of using the Code-behind model to write site pages.
        When writing a page, in order to quickly see the writing effect, dynamically compile the page, you can immediately see the effect, do not compile the entire site. The
requires each page to produce an application set.
        you want to treat a directory as a web app without needing to create a new project file.

        3. The same point
        Two projects can use "built-in development server" or external server for debugging. When using an external server, the corresponding virtual directory needs to be established. There are several options for starting with the current page, a specific page, launching an external program, starting a URL, not opening a page, waiting for an application from outside.

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.