Preface
There are two choices when creating a Web project with VS2010 . You can choose to create a website Web site directly, or you can choose to use
WebApplication Application. Just contact Web Development, see these two doubts, since is all can, then why have two? This
Of the separation, there must be a reason for it. Here are some of my summary of this issue, are from the Internet to find some information, and everyone points
Enjoy.
website
The Chinese name website, refers to in the Internet, according to certain rules, uses the HTML, ASP and so on the code language to display the special
A collection of related pages of the content, with a background for managers to operate and a front-end for users to use. From a lot of information found on the Internet,website
is to adapt to the habits of developers who have been transferred from ASP, for example: Do not need to create a namespace,CS Modify code after the
The restart is available for direct use.
1. Advantages
A. dynamically compile the page and see the effect immediately . You do not need to recompile the entire project; you can see it directly in the browser with a refresh
The effect after the change. This is also the biggest advantage of website.
B. you can generate an assembly per page, and you can also compile the page into an assembly
C. You can use a directory as a Web application to process, directly copy files can be published, do not need project files
2. Disadvantages
A. You can create a variety of folders to identify various files at the time of project development, but the bin files generated after publishing are more difficult to control. Bin
Files are collections of assemblies that have been saved by some projects.
WebApplication
the same webapplication is reserved for Microsoft to make it easier for programmers to transition from WinForm to web development. is organized by the engineering documents of the website, there are
Some special folders such as Bin, App_code, resource files, theme folders, and so on. If you open the project file with Notepad, you can see the
The files are in them. You can specify the schema for each file at compile time in VisualStudio, such as the code file (which will be compiled), the site
Files (not compiled, even for. cs files), resource files, and so on. You can also specify whether each file is excluded when it is published. Project compile-time general
The compiled files are compiled into the corresponding assembly files (DLL files) according to the different namespace.
1. Advantages
A. The website compiles quickly, uses the increment compilation mode, only then the file is modified, this part only then will be the increment compiles in.
B. the generated assembly compiled into a DLL, easy to manage, the bin directory of files will not be too much, what more is not good management.
C. you can specify that a Web site project generates a single assembly because it is a standalone assembly, so you can specify the application as you would any other project
Set name, version, output location and other information
D. you can split the site into multiple projects for easy management
E. can exclude a file from project and source code control
F. support for VSTS Team build facilitates daily build
G. more powerful code checking capabilities, and check policies under source code control
I. you can make your own rules before and after the compilation
J. Direct Upgrade of large systems built using VS2003
website and WebApplication different points
1. Web application default.aspx shows two original files and Default.aspx.cs and Efault.aspx.designer.cs;web websites
Default.aspx display has an existing file Default.aspx.cs.
2. There are two items for the Web application to regenerate and publish, and the Web site has only one publishing site.
3, Web applications and general WinForm there is no difference between the reference is the namespace, etc., the Web site after the reference appears a
The Bin folder holds DLLs and PDB files.
4. Web applications can be referenced as class libraries, and Web sites cannot be referenced as class libraries.
5. Web application can add ASP. Net Folder not included Bin, App_code;web Web site can add ASP.
Including Bin, App_Code.
6. Web applications can also add components and classes, while Web sites do not.
The transitions between them
1. Convert website to webapplication:
Online legends directly can be converted from right to website, anyway I was not found. You can create a new one for your Web application to
Need website content to add in
2. convert webapplication to website:
Delete all *.designer.cs
Bulk replace the codebehind= "FileList.aspx.cs" in the *.aspx, *.ascx, *.master paging files with
Codefile= "FileList.aspx.cs"
Summary
Simply put,website is suitable for simple, small web projects. The web is intended for large web site projects. That's what I'm summing up in this knowledge.
See the most in a word. In addition, in the new website project, we do not know if there is no sln file found on this project , in fact it is not without
It was placed in the VS2010 document in the document in the library in the computer . So we open the project only in the context of VS open, hit
Open the Web site to read the entire file directory. and WebApplication directly exists in the sln file, directly open on it. It's been saidthat website 's sln
Come on, can you open it? The answer is not possible, due to some path and configuration information reasons, after opening the project can not be completely hit after
Open.
The following are recommended some detailed links, interested can be more in-depth study
http://blog.csdn.net/dongxiaohui2008/article/details/8081615
http://blog.csdn.net/zyyjc/article/details/6150231
http://bbs.csdn.net/topics/110051268
Source: http://blog.csdn.net/cfl20121314/article/details/10034835