ASP.NET网站或ASP.NET Web应用程序? [英] ASP.NET Web Site or ASP.NET Web Application?

查看:340
本文介绍了ASP.NET网站或ASP.NET Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我开始新的ASP.NET项目在Visual Studio中,我可以在Visual Studio中的ASP.NET Web应用程序和新的ASP.NET网站创建新的网站。

When I start a new ASP.NET project in Visual Studio I can create a ASP.NET Web Application and new ASP.NET websites in Visual Studio creates new Website.

这两个ASP.NET Web应用程序和ASP.NET Web站点之间的区别是什么?为什么我会选择一个比其他?

What is the difference between these two ASP.NET Web Application and ASP.NET Web Sites? Why would I choose one over other?

如果我使用的Visual Studio 2005而不是Visual Studio 2008或Visual Studio 2010中,答案是不同的?

If I am using Visual Studio 2005 instead of Visual Studio 2008 or Visual Studio 2010, is the answer different?

推荐答案

网站

网站的项目编制的飞行。你最终会 用更大量的DLL文件,它可以是有疼痛感。它也是 给人的问题,当你有一个网页或控件 需要引用网页和控制目录 因为其他目录其他目录可能不 编入code呢。另一个问题可以是在 出版。

The Web Site project is compiled on the fly. You end up with a lot more DLL files, which can be a pain. It also gives problems when you have pages or controls in one directory that need to reference pages and controls in another directory since the other directory may not be compiled into code yet. Another problem can be in publishing.

如果Visual Studio是没有告诉重复使用相同的名称 不断,这将拿出的DLL文件新名称 通过页面生成的所有的时间。可导致具有 含有相同的类名DLL文件几位亲密的副本, 这将产生大量的错误。网站项目 介绍了Visual &工作室NBSP; 2005年,但它已被证明不被 非常受欢迎。

If Visual Studio isn't told to re-use the same names constantly, it will come up with new names for the DLL files generated by pages all the time. That can lead to having several close copies of DLL files containing the same class name, which will generate plenty of errors. The Web Site project was introduced with Visual Studio 2005, but it has turned out not to be extremely popular.

Web应用程序:

Web应用程序的项目创建为一个附加的,现在存在的一部分 的SP 1的Visual &工作室NBSP; 2005。主要的区别是Web应用程序项目 在设计工作类似与Visual&NBSP附带的Web项目;演播室  2003。它将应用程序编译成在构建一个DLL文件 时间。为了更新该项目就必须重新编译和DLL文件 发表了变化发生。

The Web Application Project was created as an add-in and now exists as part of SP 1 for Visual Studio 2005. The main differences are the Web Application Project was designed to work similar to the Web projects that shipped with Visual Studio 2003. It will compile the application into a single DLL file at build time. In order to update the project it must be recompiled and the DLL file published for changes to occur.

Web应用程序的另一个不错的功能 项目是它的多少easer从项目视图中排除的文件。在里面 网站项目,您排除的每个文件被重命名与排除 关键字中的文件名。在Web应用程序项目,该项目刚 跟踪哪些文件要包括项目视图/排除无 重命名它们,使事情变得更加整洁。

Another nice feature of the Web Application project is it's much easer to exclude files from the project view. In the Web Site project, each file that you exclude is renamed with an exclude keyword in the filename. In the Web Application Project, the project just keeps track of which files to include/exclude from the project view without renaming them, making things much tidier.

参考:<一href="http://www.megasolutions.net/AspNet/difference-between-Web-Site-and-Web-Application-Project-27210.aspx">http://www.megasolutions.net/AspNet/difference-between-Web-Site-and-Web-Application-Project-27210.aspx

这篇文章的 ASP.NET 2.0 - 网页网站VS Web应用程序项目 的同时还对为什么要使用一个而不是其他原因。下面是它的一个摘录:

The article ASP.NET 2.0 - Web Site vs Web Application project also gives reasons on why to use one and not the other. Here is an excerpt of it:

      
  • 您需要迁移大量的Visual Studio .NET 2003的应用程序VS   2005年? 使用Web应用程序项目。
  •   
  • 您要打开和编辑任何目录作为Web项目,而不   创建项目文件? 使用网站   项目
  •   
  • 您需要添加pre-构建和生成后的步骤编译过程中?   使用Web应用程序项目。
  •   
  • 您需要建立使用多个Web的Web应用程序   项目? 使用Web应用程序项目。
  •   
  • 您要生成一个程序集的每一页? 使用网站项目。
  •   
  • 您$​​ P $ PFER动态编译和工作在页面上没有建设   每个网页浏览整个网站​​? 使用网络   网站项目。
  •   
  • 您$​​ P $ PFER单页code模型,code隐藏模型? 使用网站   项目
  •   
  • You need to migrate large Visual Studio .NET 2003 applications to VS 2005? use the Web Application project.
  • You want to open and edit any directory as a Web project without creating a project file? use Web Site project.
  • You need to add pre-build and post-build steps during compilation? use Web Application project.
  • You need to build a Web application using multiple Web projects? use Web Application project.
  • You want to generate one assembly for each page? use Web Site project.
  • You prefer dynamic compilation and working on pages without building entire site on each page view? use Web Site project.
  • You prefer single-page code model to code-behind model? use Web Site project.

Web应用程序项目与网站项目 的(MSDN)解释网站和web应用程序的项目之间的差异。此外,它讨论了在Visual Studio中进行配置。

Web Application Projects versus Web Site Projects (MSDN) explains the differences between web site and web application projects. Also, it discusses the configuration to be made in Visual Studio.

这篇关于ASP.NET网站或ASP.NET Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆