asp.net-coreoptimizely

Optimizely CMS12 in IIS


We've built and deployed many Optimizely sites but recently started exploring CMS 12 running on .net Core.

The issue at the moment is that we're not able to view the site when "hosted" by IIS.

We've followed the Optimizely instructions, cross referenced it with Jon D Jones' guide/video, and it seems that once you have installed the .net core hosting package and updated the app pool it should "just work". That is not what we're seeing.

eg https://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/installing-optimizely-net-5 https://www.jondjones.com/learn-optimizely/cms/how-to-install-optimizely-cms-12-and-configure-a-development-environment/

The Optimizely project is setup in VS2022 and runs fine using IIS Express (ie clicking "Start" in VS).

However, if pointing the IIS site at the obj/Debug/net6.0/ folder (or net5.0) the site returns a 404.

/util/login and /episerver/cms/ both work in IIS Express, but not via the host name set in IIS.

"Everyone" has all permissions to everything to ensure that is not an issue.

SDK and hosting bundle for .net 5, 6 and 7 have been installed.

In all examples we've seen, we've copied the steps and still end up with 404s returned no matter the path requested.

I've tried various publish options (target runtime, deployment mode etc). Nothing seems to help.

I suspect there is something we're missing but nobody here is very au fait with .net Core as most of our clients are still running .net framework apps.

Are there any pointers, links anyone has used that has helped them?

Current setup: Windows 11 IIS 10 VS2022 Pro w/Resharper Optimizely CMS 12


Solution

  • If you are to run the project using IIS directly from the debug folder use bin\Debug\net6.0 and not the obj\ folder. Also you must add a web.config to that folder with instructions for IIS how to start the project.

    Some basics

    The apppool must be setup using "No Managed Code" enter image description here

    The web.config if missing must be added manually and 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=".\REPLACEWITHYOURPROJECTDLL.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
        </system.webServer>
      </location>
    </configuration>
    

    Note the REPLACEWITHYOURPROJECTDLL