ASP.net:网站或Web应用程序项目

时间:2023-01-17 09:12:54

Is there any difference between website and web application project? What if you are working on a project that is sort of hybrid of site and application? which project should you chose?

网站和Web应用程序项目之间有什么区别吗?如果您正在处理一个混合了站点和应用程序的项目,该怎么办?你应该选择哪个项目?

5 个解决方案

#1


9  

As for which project to choose, I would go with the Web Application Project, regardless of size. Having all of your code behind compile down into a single DLL is a major benefit for maintenance and security on the hosting end. I know there are precompile options for web site projects, but they seemed like more trouble that it was worth for me.

至于选择哪个项目,无论大小如何,我都会使用Web应用程序项目。将所有代码编译成单个DLL是托管端维护和安全性的主要好处。我知道有网站项目的预编译选项,但它们似乎更麻烦,它对我来说是值得的。

I know that the IIS filters are in place to prevent users from accessing your .vb or .cs files, but it still makes me a little leery.

我知道IIS过滤器已经到位,以防止用户访问您的.vb或.cs文件,但它仍然让我有点怀疑。

But more important to this is the nice fact that if you make a bunch of coding changes, or maybe add some classes and change the processing logic, the only thing you have to merge up is the compiled DLL and nothing else. Similarly, if you do a few UI changes (say change the stylesheet or position of a few controls), you don't have to worry about recompiling the application, you simply bring over the update .aspx page and you're done.

但更重要的是,如果你进行一堆编码更改,或者可能添加一些类并更改处理逻辑,那么你必须合并的唯一事情就是编译的DLL而不是其他任何东西。同样,如果你做了一些UI更改(比如更改样式表或几个控件的位置),你不必担心重新编译应用程序,只需将更新.aspx页面移除即可完成。

#2


12  

I'ld go the newer Web Application project (always, regardless of the size of the project).

我会去更新的Web应用程序项目(总是,无论项目的大小如何)。

There is nothing to lose and everything to gain with using the Web Application Project (you cannot say this about using the "website" only).

使用Web应用程序项目没有任何损失和一切可以获得(您不能仅仅使用“网站”这样说)。

The official list of differences are here:

正式的差异清单如下:

Use Web Application Projects when you

在您使用Web应用程序项目时

  1. Need to migrate large Visual Studio.NET 2003 applications
  2. 需要迁移大型Visual Studio.NET 2003应用程序
  3. Need to control names of output assemblies
  4. 需要控制输出程序集的名称
  5. Need stand-alone classes to reference page and user control classes
  6. 需要独立的类来引用页面和用户控件类
  7. Need to build a Web application using multiple Web projects
  8. 需要使用多个Web项目构建Web应用程序
  9. Need to add pre-build and post-build steps during compilation
  10. 需要在编译期间添加预构建和后构建步骤

Use Websites if you:

如果您:使用网站:

  1. Need to generate one assembly for each page.
  2. 需要为每个页面生成一个程序集。
  3. Prefer single-page code model to code-behind model.
  4. 首选单页代码模型为代码隐藏模型。
  5. Prefer dynamic compilation and working on pages without building entire site on each page view (that is, save file and then simply refresh the page in the browser).
  6. 首选动态编译和处理页面而不在每个页面视图上构建整个站点(即保存文件,然后只需在浏览器中刷新页面)。
  7. Want to open and edit any directory as a Web project without creating a project file
  8. 想要在不创建项目文件的情况下打开和编辑任何目录作为Web项目

@Mehrdad's link here is essential if you want to know more http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5

@ Mehrdad的链接在这里是必不可少的,如果你想了解更多http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5

#3


2  

Take a look:

看一看:

http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5 http://forums.asp.net/p/1300026/2538628.aspx

http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5 http://forums.asp.net/p/1300026/2538628.aspx

#4


0  

I'm used to create websites when I want to create a new webapplication.

当我想创建一个新的web应用程序时,我习惯于创建网站。

My current project had some problems on compiling, so I switched to a webapplication project. The step isn't very hard. Visual Studio helps you to change all necessary lines.

我当前的项目在编译时遇到了一些问题,所以我切换到了一个webapplication项目。这一步不是很难。 Visual Studio可帮助您更改所有必需的行。

#5


0  

Refer to the links in the post:

请参阅帖子中的链接:

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

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

Anthony :-)

安东尼:-)

#1


9  

As for which project to choose, I would go with the Web Application Project, regardless of size. Having all of your code behind compile down into a single DLL is a major benefit for maintenance and security on the hosting end. I know there are precompile options for web site projects, but they seemed like more trouble that it was worth for me.

至于选择哪个项目,无论大小如何,我都会使用Web应用程序项目。将所有代码编译成单个DLL是托管端维护和安全性的主要好处。我知道有网站项目的预编译选项,但它们似乎更麻烦,它对我来说是值得的。

I know that the IIS filters are in place to prevent users from accessing your .vb or .cs files, but it still makes me a little leery.

我知道IIS过滤器已经到位,以防止用户访问您的.vb或.cs文件,但它仍然让我有点怀疑。

But more important to this is the nice fact that if you make a bunch of coding changes, or maybe add some classes and change the processing logic, the only thing you have to merge up is the compiled DLL and nothing else. Similarly, if you do a few UI changes (say change the stylesheet or position of a few controls), you don't have to worry about recompiling the application, you simply bring over the update .aspx page and you're done.

但更重要的是,如果你进行一堆编码更改,或者可能添加一些类并更改处理逻辑,那么你必须合并的唯一事情就是编译的DLL而不是其他任何东西。同样,如果你做了一些UI更改(比如更改样式表或几个控件的位置),你不必担心重新编译应用程序,只需将更新.aspx页面移除即可完成。

#2


12  

I'ld go the newer Web Application project (always, regardless of the size of the project).

我会去更新的Web应用程序项目(总是,无论项目的大小如何)。

There is nothing to lose and everything to gain with using the Web Application Project (you cannot say this about using the "website" only).

使用Web应用程序项目没有任何损失和一切可以获得(您不能仅仅使用“网站”这样说)。

The official list of differences are here:

正式的差异清单如下:

Use Web Application Projects when you

在您使用Web应用程序项目时

  1. Need to migrate large Visual Studio.NET 2003 applications
  2. 需要迁移大型Visual Studio.NET 2003应用程序
  3. Need to control names of output assemblies
  4. 需要控制输出程序集的名称
  5. Need stand-alone classes to reference page and user control classes
  6. 需要独立的类来引用页面和用户控件类
  7. Need to build a Web application using multiple Web projects
  8. 需要使用多个Web项目构建Web应用程序
  9. Need to add pre-build and post-build steps during compilation
  10. 需要在编译期间添加预构建和后构建步骤

Use Websites if you:

如果您:使用网站:

  1. Need to generate one assembly for each page.
  2. 需要为每个页面生成一个程序集。
  3. Prefer single-page code model to code-behind model.
  4. 首选单页代码模型为代码隐藏模型。
  5. Prefer dynamic compilation and working on pages without building entire site on each page view (that is, save file and then simply refresh the page in the browser).
  6. 首选动态编译和处理页面而不在每个页面视图上构建整个站点(即保存文件,然后只需在浏览器中刷新页面)。
  7. Want to open and edit any directory as a Web project without creating a project file
  8. 想要在不创建项目文件的情况下打开和编辑任何目录作为Web项目

@Mehrdad's link here is essential if you want to know more http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5

@ Mehrdad的链接在这里是必不可少的,如果你想了解更多http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5

#3


2  

Take a look:

看一看:

http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5 http://forums.asp.net/p/1300026/2538628.aspx

http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5 http://forums.asp.net/p/1300026/2538628.aspx

#4


0  

I'm used to create websites when I want to create a new webapplication.

当我想创建一个新的web应用程序时,我习惯于创建网站。

My current project had some problems on compiling, so I switched to a webapplication project. The step isn't very hard. Visual Studio helps you to change all necessary lines.

我当前的项目在编译时遇到了一些问题,所以我切换到了一个webapplication项目。这一步不是很难。 Visual Studio可帮助您更改所有必需的行。

#5


0  

Refer to the links in the post:

请参阅帖子中的链接:

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

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

Anthony :-)

安东尼:-)