ASP.NET Web Site or ASP.NET Web Application?

前端 未结 25 2355
自闭症患者
自闭症患者 2020-11-21 08:26

When I start a new ASP.NET project in Visual Studio, I can create an ASP.NET Web Application or I can create an ASP.NET Web Site.

What is the difference between ASP.

25条回答
  •  北荒
    北荒 (楼主)
    2020-11-21 08:41

    Yes web application is much better than web sites, because Web applications give us freedom:

    1. To have multiple projects under one umbrella and establish project dependencies between. E.g. for PCS we can have following within web application-

      • Web portals
      • Notification Controller (for sending Email)
      • Business layer
      • Data Access layer
      • Exception Manager
      • Server utility
      • WCF Services (Common for all platforms)
      • List item
    2. To run unit tests on code that is in the class files that are associated with ASP.NET pages

    3. To refer to the classes those are associated with pages and user controls from standalone classes
    4. To create a single assembly for the entire site
    5. Control over the assembly name and version number that is generated for the site
    6. To avoid putting source code on a production server. (You can avoid deploying source code to the IIS server. In some scenarios, such as shared hosting environments, you might be concerned about unauthorized access to source code on the IIS server. (For a web site project, you can avoid this risk by pre-compiling on a development computer and deploying the generated assemblies instead of the source code. However, in that case you lose some of the benefits of easy site updates.)
    7. Performance Issue with Website(The first request to the web site might require the site to be compiled, which can result in a delay. And if the web site is running on an IIS server that is short on memory, including the entire site in a single assembly might use more memory than would be required for multiple assemblies.)

提交回复
热议问题