Kentico Web App vs Website: Which One Is Best?

   —   

One of the questions I have been asked time and again is which Visual Studio project type should a Kentico site be? A website or a web application? Both of these options have their strengths and weaknesses, as well as different development patterns for your custom code. In this article, I will cover the differences between these project types and hopefully steer you on a path toward deciding which one is best for your applications.

Selecting the right Visual Studio project is a lot like deciding what style of music is the best. If you’re from rural America, you may say Country. If you’re 22, eat a lot of Sriracha, and wear clothes from a thrift shop, there’s a good chance EDM is on the top of your list. And if you’re around 40 years old and a Technical Evangelist at Kentico, 90s Alternative is right up your alley. The point is, everyone’s individual style and preferences dictate their choice. When it comes to Web Sites vs Web Apps, it’s exactly the same.

In my experience, both project types have their pluses and minuses. Depending on how big your team is, how you handle deployments, and how your organization works as a whole, each of them may provide you some significant benefits during your project lifecycles.  Some may benefit from the time it takes to compile, while others may make it easier to track changes and test. The point of this article is to help you understand these differences and hopefully set you on the right path for your projects in the future.

While I will refer to Kentico a good bit in this article, a lot of the information is pretty universal.

A Tale of Two Types

You have to go pretty far back to know just how Websites and Webapps came to be. Way back in .NET 1.1, the Webapp concept was born in that developers would create applications and compile their code down to a single DLL. Many web developers at the time were used to the ASP model, in where each page contains all it needs to run, thereby, you could easily isolate a page and just update it, without affecting the rest of the application. This caused a good bit of backlash in the community and a lot of developers had difficulty adopting this new model.  With the release of .NET 2.0, Microsoft added back a new model to help this, the Website project type. In this model, pages continued to be their own entity, allowing developers to update a single file without a recompile.

And from that point, the debate between the two began…

Project Type Differences

At the core, Webapps and Websites achieve the same thing, in that they both can be used to create a robust, functional application. The differences lie in how the code is structured, compiled, and updated.  Both types can be used with Kentico, and both are fully capable of all the functionality of the other model. The most notable difference are:

  • Webapps are pre-compiled into a single DLL. All code-behind logic is packaged up in a single DLL and then deployed to the server.
  • Websites are compiled “on-the-fly.”  This means that each page (and its code-behind file) is a stand-alone entity which is compiled by IIS when that page is requested.
  • Websites utilize the App_Code folder for compiled code (references).
  • With Webapps, every logic (code-behind) change requires a full recompilation of the project to implement. Because all logic is compiled into a single DLL, even the smallest of changes requires a full compilation (and deployment) of the DLL.
  • With Websites, an individual page can be updated and deployed, without requiring a re-compilation.
  • Webapps can leverage MSBuild actions (pre-build actions, post-build actions, etc.).
  • Building Webapps is a lot faster than building websites. This is due to how the Visual Studio compiler is optimized for Webapps and not so much for Websites.
  • A Website project can be converted to a Webapp.

There are a lot more differences between the two. You can read about a lot of them here:

Web Application Projects versus Web Site Projects in Visual Studio

Kentico and Project Types

Kentico’s history with project types is an interesting one. Originally, Kentico was only geared for Website projects. Because of their ease of development and maintenance, Websites were a good choice because it allowed developers to update pages individually and rapidly develop and maintain their sites. With the emergence of Azure Cloud Services, Kentico began supporting the WebApp model, as well. This is due to Cloud Services requiring this project type in order to be deployed on the Virtual Machines properly. Since Version 6, Kentico has continued to support both project types because of the differences in how clients develop with the platform.

Which Project Type Is Right for Your Project?

Now that you had a history lesson on project types and Kentico, let’s get to the real question everyone asks. Which project type should they use? From a platform perspective, it doesn’t really matter. Both will work fine for your projects, so it will come down to how you want to develop.  I’ll try and break down the Kentico-centric differences to help you decide.

Websites

  • Faster to update.
    • Only need to update a single file.
  • Faster to deploy.
    • Can deploy a single file instead of the entire project.
  • Better suited for smaller teams with more dynamic/fluid development/testing/deployment practices.
    • Good for teams that deploy directly to their servers. (Gasp!)
    • Good for teams without defined testing procedures/processes.
  • Cannot leverage many built-in testing/deployment options. (MSBuild, etc.).
  • May limit deployment options, depending on target location.
  • Code is not compiled until the page is requested.

Webapps

  • Longer to update.
    • Require an entire re-compilation of the project.
  • Longer to deploy.
    • Updates require a full deployment of the application (DLL).
  • Requires stricter development practices.
    • Demands full testing of the application prior to deployment because the entire application is being updated.
  • Better suited for larger teams with established development/testing /deployment practices.
  • Can leverage MSBuild actions for pre/post build actions.
  • Can be deployed to nearly any location.
  • All code is compiled on the first request.

Casting My Vote

I think if you asked 10 developers this question, you may get answers for both types, however, I believe Webapps are becoming more popular. For me, I would agree in that Webapps are probably your best bet. Why, you ask?

  • Webapps require developers to be more structured. This will result in better code, better testing, and a more standardized way of developing.
  • Webapps require that an application be tested thoroughly before deployment. While this may prolong development, it does ensure a better solution and eliminate potential issues.
  • Webapps compile much faster. Making sure your code compiles is always a good thing and this process should only take a minute or two with Webapps.
  • Webapps align with the Visual Studio / MVC Web App project model.
  • Webapps can allow namespaces to be better managed and controlled.
  • Websites present an environment where code can be updated quickly (and possibly untracked). Proper project development and maintenance requires strict adherence to update procedures and Webapps force you into this model.
  • Webapps are compiled on the first hit. This means that subsequent hits to the site should be faster as the logic is already loaded into memory.

Wrapping Up

So there you have it. Hopefully this blog answers a few questions you may have had about Visual Studio project types and how they fit with Kentico. The main takeaway is that, regardless of which type you choose, Kentico will run well. Each will have some pros and cons, which may affect your development experience. Be sure to try them both and choose the one that aligns your/your company’s development model and practices. Good luck!

UPDATE

Kentico Consulting Manager Miro Remias let me know about some more optimzations you can use with web apps to speed up your compilation and publishing times.

"Even though web applications are kind of precompiled, not everything is precompiled, so in order to get the best performance, it still make sense to do a precompilation in VS with publish function even for web application type of project. I learned this with one customer who was precompiling web application and I was like 'why?', but they are right, there is still some gain of precompiling web application."

I have looked into pre-compilation before and it defintely adds some benefits to your buidling and deploying. 

You can check out pre-compilation here.

Learn More

There are number of great blogs and articles on this topic. Check out the following links for more information on Kentico, VS project types, and differences between them.

Speeding Up Your First Request in Kentico by 50%

How to convert Kentico CMS web site to a Web Application

Which web project type to choose?

Share this article on   LinkedIn

Bryan Soltis

Hello. I am a Technical Evangelist here at Kentico and will be helping the technical community by providing guidance and best practices for all areas of the product. I might also do some karaoke. We'll see how the night goes...

Comments

Justin James commented on

Excellent write up Bryan. Tough choice when you have to choose between Website and Mobile Apps as both have their own share of benefits with Kentico being the GOTO CMS partner. But I shall still recommend going for the Website due to its extensive reach.
I have written a blog showing how Kentico has an immense market share in the e-commerce industry which can be helpful :
http://www.rigelnetworks.com/kenticos-market-share-e-commerce-industry/

Mateusz Warcholinski commented on

I agree with you Bryan!

I just wrote a post with 10 questions I always ask before building a mobile app or a web app/website first
http://brainhub.eu/blog/2016/03/04/app-vs-website-which-to-develop-first/

Bryan Soltis commented on

Glad you enjoyed it Brandon. Technically speaking, it's really up the developer / company to say which is best. For me, web apps lend themselves to more structured processes and automated builds, all of which help make better sites.

Brandon commented on

Excellent write up! I'm glad you opined on the subject in addition to giving the information instead of sitting on the fence.

rhutnyk commented on

Brian, thanks for great post. I, as a developer, want to stress that debugging is real pain with web application project.