Web Site or Web Application in ASP.NET

后端 未结 7 795
忘掉有多难
忘掉有多难 2020-12-10 22:09

Which Visual Studio template should be used for a ASP.NET web site, the Web Site template or the Project | Web Application template?

相关标签:
7条回答
  • 2020-12-10 22:50

    Both function and perform similarly, but still differ in following ways:

    Web application:

    • We can't include C# and VB pages in single web application.
    • We can set up dependencies between multiple projects.
    • Can not edit individual files after deployment without recompiling.
    • Right choice for enterprise environments where multiple developers work unitedly for creating, testing and deployment.

    Web site:

    • Can mix VB and C# page in single website.
    • Can not establish dependencies.
    • Edit individual files after deployment.
    • Right choice when one developer will responsible for creating and managing entire website.
    0 讨论(0)
  • 2020-12-10 22:56

    you'd better read this: http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx in my opinion it depends on what you are developing

    0 讨论(0)
  • 2020-12-10 22:58

    If you're using Team Foundation Server for source control, you'll probably have to use a Web Application Project, as you need a .csproj file.

    There are more details from Jeff Atwood himself: Web Site Projects vs. Web Application Projects

    Web Site web projects are particularly painful in Team System due to the lack of a physical file that contains project information and metadata. For example, it's impossible to check in code analysis rules on Web Site projects, because the code analysis rules are stored entirely on the client!

    0 讨论(0)
  • 2020-12-10 23:08

    I prefer a website. A website is a collection of files in a directory. It becomes more portable and deployable. A web application clouds the issue with a project file.

    0 讨论(0)
  • 2020-12-10 23:11

    Personally I use web application projects exclusively now. I actually converted a rather web site to a web application because of compilation times for the web site.

    I also use pre-build events to move configuration specific configuration files around and pre-build and post-build events are not available in web sites.

    0 讨论(0)
  • 2020-12-10 23:13

    Web application projects works more like a traditional VS project, which has a project file, is compiled in one step and so on.

    Web site projects works more like classic ASP or PHP-sites. There is no project file (references are stored in the solution file), and pages are recompiled dynamically on the server. The nice thing with web sites is that you can just ftp to the server and change a file in a text editor. You dont need VS. Some may hate that, though.

    It probably depends on your background. If you are used to ASP or PHP style development, web site projects will seem more natural to you. If you have a traditional application developer background, web application projects will seem more natural.

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