Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

How do you set up a local development environment using IIS?

Vote:
 

Hello,

I apologize in advance if this comes across as a rant.

I don't understand why it's so difficult to put together a clear and concise installation guide.

I would like to set up a development environment on my laptop using IIS (full IIS, not IIS Express). I have been looking for a guide but so far I haven't found one.

  • This page -- Set up a development environment (optimizely.com) -- has almost no value. The page does not come close to describing how to set up a development environment.
  • There is a link to a System Requirements page. The System Requirements page says nothing about the additional Windows features that need to be enabled (e.g., Turn Windows features on or off).
  • There is a link to Internet Information Services (IIS), but the link is for IIS Express (not IIS).
  • There is a link to SQL Express or SQL Server Developer Edition and Management Studio. The link goes to a page on the Microsoft website under the /en-in locale.

Is there a guide that explains (step-by-step) how to get CMS 12 running on a developer's machine using IIS and SQL Server 2022 Developer edition?

  • IIS: Full IIS (not IIS Express)
  • Application Pool settings
  • Bindings: {something}.local... HTTP and HTTPS (with a self-signed certificate)... required entries in the hosts file
  • Access Rights (permissions on the folder containing the code)
  • SQL Server: SQL Server 2022 Developer (with details about enabling mixed authentication)
  • Additional requirements: e.g., URL Rewrite Module 2.0

My opinion - a development environment should include the tools (Visual Studio, IIS, SQL Server) as well as sample code (either Alloy, or Foundation, or Mosey). After I spend the time building my 'development environment' I'd like to be able to launch the site, login to the back-end, open the code in Visual Studio, experiment with things (create a new block, create a new page, create a new scheduled job).

If such a thing already exists then I apologize for the rant and I would appreciate (very much) if someone could provide a link to it.

If it does not... why not?

Thank you all! Have a great weekend!

Glen Fergo

#321829
May 10, 2024 16:30
Vote:
 

Hi Glen,

It would probably be worth taking a look at this article from Jon Jones:

https://www.jondjones.com/learn-optimizely/cms/how-to-install-optimizely-cms-12-and-configure-a-development-environment/

#321830
May 10, 2024 16:49
Glen Fergo - May 16, 2024 19:28
Paul,

I found that article before you posted the link. (I've visited Jon's site many times. I'm a big fan of his!) But since you posted the link, I thought I would give it another try.

First - The article is outdated. It tells you to download the ASP.NET Core 5 Hosting Bundle. I would think that we should be using Core 6 (at least) now.

Second - I believe I performed all of the steps correctly, but the site still would not load. The article says this: "when you type the hostname into a browser, e.g. http://MyHostname, you should be able to access the site." For me, it did not work unless I also added :8000 (port 8000).

Third - The section on "Creating A CMS User" makes it seem like you need to add a .cs file (UsersInstaller class) and add just one line to the start.cs file.

- I believe the file is Startup.cs (not start.cs)
- Additional modifications are needed (namely, additional using statements at the top). You can't add just the one line shown in the article.

Fourth - I think the article omits an important step. Running the site over https using a self-signed certificate.

** Perhaps my biggest complaint is this... why am I reading a blog posting on a personal site? Why isn't there a clear (up-to-date) guide on the Optimizely website? **

If I'm nitpicking, I apologize. It just seems odd to me that Opti cannot put together an installation guide. I think it would take a Technical Writer two days. That's it.

Vote:
 

Probably everyone would agree that over the years the documentation has became more concise and less beginner friendly. There must be a sweet spot between describing every required step to setup the environment and showing just the essence of it, assuming that the developer has already prior knowledge, but I am not sure where that sweet spot lies.

#322012
Edited, May 14, 2024 7:43
Glen Fergo - May 16, 2024 19:32
As I said above, if I'm nitpicking, I apologize.

I believe Opti should have an Installation Guide and I believe it should describe every required step. If it doesn't do that... can it really be called an Installation Guide?

The Developer with years and years of experience doesn't need this guide. He/she has installed Opti a bunch of times already. He/she could probably write the guide.

The beginner needs this guide. And the beginner needs to know all of the steps.
Vote:
 

I recorded this a while ago, https://www.youtube.com/watch?v=U0zWMnfW-Hk

Development environments are a matter of taste, usually I develop in Linux, so my taste include setting up SqlServer in docker which I always advice people to do. Never ever install SqlServer locally for development regardless of your OS.

The hosting part doesn't really matter, sometimes I use the dotnet run/watch, sometimes NGINX, and occasionally IIS. If you have a working project that you can run using the dotnet run command create a web.config file if it doesn't exist and go wild with IIS.

It should look like this

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<location path="." inheritInChildApplications="false">
		<system.webServer>
			<handlers>
				<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
			</handlers>
			<aspNetCore processPath="dotnet" arguments=".\alloy.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
				<environmentVariables>
					<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
				</environmentVariables>
			</aspNetCore>
		</system.webServer>
	</location>
</configuration>

Replace alloy.dll with your project main dll-file and add or remove any environment varialbles that are suitable for you. The base path of IIS should be pointed to the bin\Debug\net8.0 folder in your project. 

So, while hosting in IIS is quite simple and effective, maybe I should do a video about that as well.

#322015
Edited, May 14, 2024 9:15
Glen Fergo - May 16, 2024 19:48
Hi Eric,

>>> Development environments are a matter of taste, usually I develop in Linux...

While I agree that some Developers might prefer using Windows and Visual Studio 2022 while other Developers prefer using Linux and Visual Studio Code (or another IDE), I think most will not be given a choice. I think most will use what the company dictates/provides. (If they send you a laptop running Windows then I think you'll be using Windows and IIS.)

>>> create a web.config file if it doesn't exist and go wild with IIS

Web.config? Isn't that CMS 11? (.NET Framework) Aren't we talking about CMS 12. (.NET Core) Did you mean appsettings.json? (Perhaps I'm missing something.)

>>> Replace alloy.dll with your project main dll-file

This goes back to something I wrote in the original post. If we want something more than an empty site (no pages, no users, nothing), should we use Alloy? Should we use Foundation? Should we use Mosey?

I could understand having one for CMS only and one for CMS with Commerce. (e.g., Use Alloy if you want CMS only. Use Foundation if you want CMS and Commerce.)

What I don't understand is why some pages in the developer documentation refer to one... some pages refer to another... some pages refer to yet another.

When you're starting out with CMS 12... I think we need one installation guide, with all of the steps, that is easy to follow.

I appreciate you taking the time to respond and for recording the video!! I really do!! Thank you!!

Glen
Glen Fergo - May 16, 2024 20:05
Eric,

I feel stupid for asking. It almost feels like I should know the answer.

>>> Never ever install SqlServer locally for development regardless of your OS

Why not?

At my last five jobs, I had SQL Server YYYY Developer running locally. So did all other members of the Development team.

What am I missing?

Thanks for your patience!!

Glen
Eric Herlitz - May 17, 2024 7:29
>>> Win/Linux etc
I'd never accept someone else to dictate how my development environment is setup. I usually put that in my contract.

>>> Web.config? Isn't that CMS 11?
Web.config is also related to the IIS-hosting, not only .NET Framework. IIS require a web.config to start the .NET core binary.

>>> Replace alloy.dll with your project main dll-file
Never ever use alloy or foundation for your project, It is the "contoso" equivalent from Optimizely and not a suitable template for a production project. So my reference is just to examplify a project that everyone know.

>>> Never ever install SqlServer locally for development regardless of your OS
Install it locally but use Docker. SQL server is a parasite in your OS and a nightmare to update, well you practically don't since you setup another instance, this having more and more instances running just to keep yourself compatible. Now, this may not be an issue in a lot of oragnisations where someone descided that "we are running SQL2019CU4 to the end of times", but that is usually not the case, especially if you are working with Optimizely.

Also, installation of SQL Server in docker is swift, I mean, we are talking about a few seconds to download and then you are done. Store your databases in a separate folder, you may have as many versions of SQL Server as you wish without them interfering. You may cap their resource usage, you can kill them when you dont need them, delete those that are not used anymore etc. And the performance is great.

I can't remember how many times I've had a .bak delivered then to find out that my DB is to old, or new to run the db. When exporting to a customer or another developer the story is the same. There is literally no reason to install SQL server in any other way than docker unless if you really like to make things harder for yourself.
Vote:
 

Hello Glen,

using IIS introduces some complexity. The combo .net core (cms 12), kestrel and local db can give you a very smooth local development setup.
It enables us to clone the repo, set some basic config (like find index) and just start the app.

  • we auto provision the database
  • we generate some minimum content (in case we don't use a db backup from DXP) 
  • and no admin rights are needed

In our company we're now experimenting with DevContainers to make it even more smoother.

Would it be possible to share the reasons you need to use IIS? Maybe it can bring new ideas, suggestions...

Thanks! 

 

#322941
May 31, 2024 13:54
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.