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

前端 未结 25 2323
自闭症患者
自闭症患者 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:28

    This may sound a bit obvious, but I think it's something that is misunderstood because Visual Studio 2005 only shipped with the web site originally. If your project deals with a website that is fairly limited and doesn't have a lot of logical or physical separation, the website is fine. However if it is truly a web application with different modules where many users add and update data, you are better off with the web application.

    The biggest pro of the website model is that anything in the app_code section is dynamically compiled. You can make C# file updates without a full redeploy. However this comes at a great sacrifice. A lot of things happen under the covers that are difficult to control. Namespaces are difficult to control and specific DLL usage goes out the window by default for anything under app_code since everything is dynamically compiled.

    The web application model does not have dynamic compilation, but you gain control over the things that I have mentioned.

    If you are doing n-tier development, I highly recommend the web application model. If you are doing a limited web site or a quick and dirty implementation, the web site model may have advantages.

    More detailed analysis can be found in:

    • Web Application Projects and Web Deployment Projects are here
    • Web Site or Web Application?

提交回复
热议问题