网站项目与 Web 应用程序 - 哪个更好?

发布于 2024-07-14 01:26:58 字数 239 浏览 5 评论 0原文

我刚刚开始使用cms(N2),它有一个模板基本实现,使用vs2008中的网站项目模板。 我注意到编译它比使用我更习惯的 Web 应用程序项目花费的时间要长得多。

我的问题是:

  1. 为什么编译似乎需要更长的时间?
  2. 使用哪个更好?
  3. 我应该将其转换为网络应用程序吗?

如果这是重复的,我深表歉意,但我找不到类似的问题。

干杯

I've just started using a cms (N2) which has a template basic implementation using a web site project template in vs2008. I've noticed that when compiling it it takes a lot longer than using a web application project which I am more use to.

My questions are:

  1. Why does it seem to take a lot longer to compile?
  2. Which is better to use?
  3. Should I convert it into being a web application?

I apologise if this is a duplicate but I couldn't find a similar question.

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

数理化全能战士 2024-07-21 01:26:58

主要区别是:

Web应用程序项目中,所有内容都已预编译,所有代码隐藏页面都将编译为 .dll ---- 在Web站点项目项目中没有任何内容被预编译,编译器将编译所有内容以确保其有效,但不会上传任何已编译的页面。 当用户第一次尝试访问该站点时,每个页面都会编译到自己的 dll 中。 这意味着在网站项目中,您可以上传单个代码隐藏文件。

命名空间 - 在Web 应用程序项目中,默认情况下会创建命名空间,但在网站项目中则不然。

项目文件 - 网站项目没有“cproj”文件,而 Web 应用程序项目则有。

转换为Web应用程序项目可能会更加困难那么您尤其会想到如果您严重依赖 appcode 文件夹。

我个人更喜欢Web 应用程序项目,我发现它们更易于使用,而且部署起来也不那么烦人。 我个人只会在非常小和简单的事情上使用网站项目。

额外阅读 MSDN

The Major differences are:

In a Web Application project everything is pre-compiled all the codebehind pages will be compiled into a .dll ---- In a Web Site Project nothing in the project is pre-compiled, the compiler will compile everything to ensure it is valid but none of the compiled pages are uploaded. When a user first attempts to access the site each page is compiled into its own dll. This means in a Web Site Project you are able to upload a single codebehind file.

Namespaces - In a Web Application project namespaces are created by default in a Web Site Project they are not.

Project files - A Website Project does not have a "cproj" file a Web Application project does.

Converting to a Web Application project can be more difficult then you think especially if you rely heavily the appcode folder.

I personally prefer a Web Application projects I find them easier to use and less annoying to deploy. I would personally only use web site project on something very small and simple.

Extra reading from MSDN

↘人皮目录ツ 2024-07-21 01:26:58

除了 Chris 提供的信息之外,您还应该注意,对于 Web 应用程序项目,配置文件不是开箱即用的:

http://www.codersbarn.com/post/2008/06/01/ASPNET-Web-Site-vers- Web-Application-Project.aspx

这里有一个解决方法:
http://code.msdn.microsoft.com/WebProfileBuilder

基本上,Web 应用程序项目确实没有像网站项目那样将 Profile 对象自动添加到每个页面,因此我们无法对 web.config 文件中定义的配置文件属性进行强类型编程访问。

安东尼:-)

In addition to the info provided by Chris, you should also note that for Web Application Projects, Profiles are not available out of the box:

http://www.codersbarn.com/post/2008/06/01/ASPNET-Web-Site-versus-Web-Application-Project.aspx

There is a workaround available here:
http://code.msdn.microsoft.com/WebProfileBuilder

Basically, the Web Application Project does not have the Profile object automatically added to each page as with the Web Site project, so we cannot get strongly-typed programmatic access to the profile properties defined in our web.config file.

Anthony :-)

一曲琵琶半遮面シ 2024-07-21 01:26:58

我的偏好是使用网站项目而不是网络应用程序。 我在开发过程中主要依靠“在浏览器中查看”来执行页面,而不是f5。 我可以保持浏览器窗口打开并修改代码,而无需关闭运行时浏览器。 通常,如果我需要调试,我会将 IDE 附加到适当的进程。 根据我的经验,这样做比每次必须编译或进行更改时都编译并重新启动应用程序更有效。 如果应用程序有登录页面,这种情况会更加严重。 避免每次按 F5 时都需要登录 - 当然有一些方法可以进行设置。 但偏好并非如此。

My preference is to use Website project over web application. I mainly rely on "View in Browser" to execute the page during development and not f5. I can leave the browser window open and modify code without closing the runtime browser. Usually if I need to debug I attach the IDE to the appropriate process. In my experience it much more efficient to do it this way instead of compile and restarting the app everytime I have to compile or make changes. This is magnified even more if the app has a login page. Need for logging in is avoided everytime F5 is pressed - granted there are ways to set it up. But preference is not to.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文