Try our conversational search powered by Generative AI!

Add-on for EPiServer 12 from the scratch


Hi there,

I'm trying to build a simple Add-on for EPiServer 12 but faced an issue. Well, my add-on is quite simple: only one class-controller.

using Microsoft.AspNetCore.Mvc;

namespace MyEPiModule
    public class HelloController : Controller
        public ActionResult Index()
            return new ContentResult { Content = "Hello from my EPiServer module!" };

        public ActionResult Show()
            return new ContentResult { Content = "Show: Hello from my EPiServer module!" };

I added one dependency EPiServer.CMS v12.2.1 (I have Foundation site running with the same dependency).

module.config is simple too

<?xml version="1.0" encoding="utf-8"?>
<module loadFromBin="false"
		description="My first EPiServer NET5 Core module"
    <add assembly="MyEPiModule"/>

    <route url="{moduleArea}/{controller}/{action}/">
		<add key="moduleArea" value="MyEPiModule" />
        <add key="controller" value="Hello"/>
		<add key="action" value="Index"/>

So, I built the module, created a folder /modules/_protected/MyEPiModule, put module.config here, copied MyEPiModule into bin folder (all dlls are here).

But requests /episerver/myepimodule/hello/index and /episerver/myepimodule/hello/show response HTTP404 Not Found.

I checked another OOTB requests:

/EPiServer/EPiServer.OpenIDConnect.UI/OpenIDConnectToken/refreshtokens - HTTP 500
/EPiServer/cms/about/license - redirect
/EPiServer/commerce/catalog - HTTP 200

All of them work fine. Seems like I missed something valuable, but cannot get what the thing I missed.

I developed EPiServer add-on before, for v11. But haven't seen such issues. Could you give me advice how to cause this simple add-on work, please?

Feb 09, 2022 16:21

@Mark Hall helped me with the issue

By default the module system does not autodiscover. You can either turn on autodiscover

services.Configure<ProtectedModuleOptions>(x => x.AutoDiscovery = EPiServer.Shell.Configuration.AutoDiscoveryLevel.Modules);

or register manually like

services.Configure<ProtectedModuleOptions>(x =>
                if (!x.Items.Any(x => x.Name.Equals("MyEPiModule")))
                    x.Items.Add(new ModuleDetails
                        Name = "MyEPiModule"
Feb 11, 2022 16:05
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.