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

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

    There is an article in MSDN which describes the differences:

    Comparing Web Site Projects and Web Application Projects

    BTW: there are some similar questions about that topic, e.g:

    • Web Site vs. ASP.Net Web Application in Visual Studio note: was removed, no longer on SO
    • website or webapplication in.ASP.NET
    0 讨论(0)
  • 2020-11-21 08:27

    Web Site = use when the website is created by graphic designers and the programmers only edit one or two pages

    Web Application = use when the application is created by programmers and the graphic designers only edit one or two paged/images.

    Web Sites can be worked on using any HTML tools without having to have developer studio, as project files don’t need to be updated, etc. Web applications are best when the team is mostly using developer studio and there is a high code content.

    (Some coding errors are found in Web Applications at compile time that are not found in Web Sites until run time.)

    Warning: I wrote this answer many years ago and have not used Asp.net since. I expect things have now moved on.

    0 讨论(0)
  • 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?
    0 讨论(0)
  • 2020-11-21 08:31

    A "web site" has its code in a special App_Code directory and it's compiled into several DLLs (assemblies) at runtime. A "web application" is precompiled into one single DLL.

    0 讨论(0)
  • 2020-11-21 08:32

    In a web application you can create the layers of your project's functionality and can create inter-dependencies between them by dividing it into many projects, but you can never do this on a website.

    0 讨论(0)
  • 2020-11-21 08:35

    It is always depends on the requirement of your client. ASP.NET just includes flexible features that the user needs for security and easy maintenance of your application.

    You can think of a Web application as a binary file that runs inside the ASP.NET framework. And Web sites as a static webpage that you can review and easily deploy source code to.

    But the advantage and disadvantages of these two ASP.NET technologies come what is good.

    0 讨论(0)
提交回复
热议问题