1. What is the best practice for Sitefinity?
The question might cause blurriness since quite a number of solutions and services that can cross Sitefinity. As a new user, you probably are drowning in information, people experienced different ways to manage depends on their boss.
Sitefinity is a sophisticated software and meant to be fully controlled in order to take all of its benefits.
The frontend users cannot take the entire advantages unless they know what in the backend layer that Sitefinity could offer.
By using a local machine to host your Sitefinity, you have done yourself lots of favor, saved money, more control over your site and tons of backend features that you may need to pay a large pool for the same results. Huge bang for the buck!
As you should already know, Sitefinity like any other CMS needs to work along with a database and a host (apparently a domain should be the very last step once your site is completed).
However, Siteifnity CMS Project Manager cannot give you what you need as the localhost can. This guide will help the backend, even the non-technical users to have the power of Internet Information Services (IIS) over Sitefinity projects. This to spark the way for the journey of using Visual Studio alongside afterward.
What you need to know beforehand:
- We will be using windows localhost to deploy the Sitefinity project using IIS
- Have your Sitefinity CMS installed on your computer as well as configured the database already
- Mid-level IT to understand and configure some windows’ components (It’s alright if you are a non-experienced IT user, this guide was made to help you through)
If you are not sure how to get your Sitefinity installed, follow the previous guide to set up a database with MS SQL Server Express.
Start a new site project
Create a new Sitefinity project and name it whatever you want. You can just rename the Default project if you want to use it without setting up a new one.
In this workflow I recommend you to start your own project to get the hang of it.
Open up your new project as usual and have your database configured with SQL Server Express or any other option that suits you.
At this stage, things are getting sensitive to your local project. The CMS Project Manager is like a portal to create a temporary host for your Sitefinity site. It has to be opened at all time and when accidentally closed, your site will go down.
Therefore, most users especially the IT professionals tend to use a local machine to develop within their local environment. For many large organizations, localhost is their priority.
We will use Internet Information Services (IIS) to gain control over your Sitefinity project.
NOTE: If you want more control over your database, SQL Server Express is not the ideal solution.
IIS is a component of Microsoft Windows, you do not need to download anything nor purchasing whatsoever.
You can activate this feature at any time by either going to Run and type in optionalfeatures or accessing Turn Windows features on or off in Control Panel.
Scroll down and tick Internet Information Service. By default, this feature is disabled. You should be able to use IIS by now however to support a framework like Sitefinity CMS, you also need to activate the latest version of ASP to work properly.
Under Internet Information Services, descend to Application Development Features and tick ASP.NET 4.7. Windows will also automatically activate the associated features, leave them be and all good to go.
Once the activation is completed, you might be asked, depends on your machine to restart. You must reboot so all the functions can be fully integrated.
When the system is back on, IIS is now running in the background and you know you have successfully activated IIS by typing localhost on the web browser. A page was created by default.
Create a host with IIS
Open your IIS Manager, on the left side, expand your local machine connection and right-click on the Sites to Add Website.
- Site name: Put a reasonable name here, this will be used to distinguish your sites within IIS Manager.
- Physical path: This is the path to the project that you created earlier with Sitefinity CMS Project Manager. In other words, this path is exactly the same as you specified at the beginning.
- Host name: it’s the actual local domain that you will later use this on your browser.
Hit Ok and your local host has been created.
NOTE: For best practice, try not to use the same name for both Site name and Host name. Also, try not to name your host the same as your lived domain name.
For example, you purchased a domain named abc.com. To avoid confusion, if you put abc.com in Host name, keep in mind that what you see on your browser is just a visual of localhost.
This is the reason I always put .local for the host’s suffix. In real life, the backend developer may face 20 projects at the same time, therefore, it’s crucial to keep your names organized and unique.
DNS forward your local site to a local machine
You just created a local site and enable your local machine to look up your site, but it will never work if your site does not look back at your local machine. It’s simple like the two lovers, both must look at each other to connect.
In this case, open your hosts file with Notepad located at C:\Windows\System32\drivers\etc and add an extra line at the bottom with the format 127.0.0.1 deitatown.local
127.0.0.1 is the default iPV4 address for every Windows PC, followed by the Host name you created earlier. Save it and you are almost there.
NOTE: You are not allowed to save this file unless you have a full privilege to modify it.
Now open your browser and put your Host name address with the format should be abc.local.
At this stage, if Sitefinity works, you can ignore the rest of this tutorial or if you are experiencing the Failed Login problem, you have nothing to worry about and congratulations you are just 1 more step away.
You can fix this problem in many ways. The core issue is your computer was not sure if the IIS Apppool user with the name abc does have a right to access the local files.
When you install your projects in the system drive, this happens. If you install your projects on a different drive (other than C drive), this may never occur.
All you need to do is granting the privilege for the IIS Apppool users to access the project directory however it is still a myth for the right solution since different windows OS comes with a different method.
The easiest way to get through this barrier is to create a new user with all the rights to access everything and assign this superuser for managing the IIS assets once and for all.
This makes sense when you are working for a company that can gain manual access to different people rather than using the windows’ default credentials.
Create a new user to manage IIS
Use Run and type in compmgmt.msc to open up the Computer Management
Expand System Tools and descend to Local Users and Groups, select Users segment, and right-click to bring up the New User panel.
We just need to fill in the User name, Password, and check the box Password never expires. Because this will be the superuser for all purposes so I recommend using a short and suitable name.
Now hit Create and close the panel, you should see a new user now has been created, right-click on it and select Property, under Member Of tab, click Add and type in Administrators, hit Ok and this user has been assigned a full power.
Head back to your IIS manager, select Application Pools tree, inside the Application Pools panel is a list of your available pools, right-click on the host we have been working on, and bring up the Advanced Settings panel.
Scroll down till you see the Identity option, by default it is set as ApplicationPoolIdentity. Reassign the user by clicking on the three-dot icon right next to it.
Choose Custom account and hit Set, fill in with your new user credentials and ready to go.
Now when you rerun your local domain on the browser, your Sitefinity should go live. At this point you can completely develop your project without running Sitefinity CMS Project Manager, instead, your localhost will do the job as you go.
If you have done it right, your local domain will be accessible with a relief announcement awaiting for you.
- You can always go back and relocate the directory of Sitefnity project by clicking on Basic Settings within the IIS Manager.
- You can limit the number of users from accessing a particular site by using Limits option under Configure section in IIS Manager.
At this point, you are able to host your Sitefinity project with IIS as well as configuring the host by yourself.
Some advantages that you will inherit from IIS localhost include:
- Easier to develop your website locally
- Faster at everything
- It’s a bang for the buck
- No internet required
- Support multiple users for constant workflow and much more
We now have all the weapons ready, the fun begins from here. Do you have any other solution when you meet the error above, I would love to see your opinion.
I hope you would stick with me and should you have any issue during this tutorial, leave a comment down there. Good job folks! I’ll see you soon.