Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dean Smith 2 posts 72 karma points notactivated
    Jan 19, 2022 @ 16:35
    Dean Smith
    0

    Host Umbraco in IIS web site child application

    Hi,

    We are trying to host Umbraco v9.1.2 in IIS in a site child application called cms.

    IIS web site application

    We set the applicationvirtualpath in the appsettings.json.

    "Umbraco": {
    "CMS": {
    "Hosting": {
    "Debug": false,
    "ApplicationVirtualPath": "/cms/"
    }
    

    When we try to access umbraco under the http://website/cms, we get a page not found for our cms pages (and this is working when umbraco is in the root web site).

    Page Not found

    Also, if we try to access the back office, the screen loads but some resources are not working:

    BackOffice

    We have tried to play with these Umbraco global settings:

    "UmbracoPath": "~/umbraco",
    "IconsPath": "~/umbraco/assets/icons",
    "UmbracoCssPath": "~/css",
    "UmbracoMediaPath": "~/media",
    "ReservedUrls": "~/.well-known,",
    "ReservedPaths": "~/app_plugins/,~/install/,~/mini-profiler-resources/,~/umbraco/,",
    

    but no success.

    we also, added this to our startup.cs

    app.UsePathBase(new PathString("/cms"));
    

    Even with these parameters, the api urls and some resources url are still not set properly.

    It seem the LinkGenerator.GetPathByAction is not considering the PathBase.

    Is there something else we need to set. How can we get this to work properly?

    thanks

  • Ronald Barendse 39 posts 218 karma points hq c-trib
    Jan 20, 2022 @ 12:55
    Ronald Barendse
    0

    I've tested this on a clean install by changing the URL/path in the Properties\launchSettings.json file's iisExpress section to:

    "applicationUrl": "http://localhost:9000/cms"
    

    And setting the ApplicationVirtualPath hosting setting to /cms, which should represent the same setup as you've described (but using IIS Express and stripping the trailing slash).

    This did result in the front-end (The Starter Kit) rendering all links/images without an issue, but the back-end showed the same error.

    When inspecting the global JavaScript variable Umbraco.Sys.ServerVariables on the login screen, it's clearly not including the application virtual path when generating the URLs:

    {
        "umbracoUrls": {
            "externalLoginsUrl": "/umbraco/ExternalLogin",
            "serverVarsJs": "/umbraco/ServerVariables",
            "iconApiBaseUrl": "/umbraco/backoffice/umbracoapi/icon/",
            "authenticationApiBaseUrl": "/umbraco/backoffice/umbracoapi/authentication/",
            "currentUserApiBaseUrl": "/umbraco/backoffice/umbracoapi/currentuser/",
            "previewHubUrl": "/umbraco/PreviewHub"
        },
        "umbracoSettings": {
            "imageFileTypes": "png,jpg,jpeg,jfif,gif,bm,bmp,dip,tga,vda,icb,vst",
            "maxFileSize": "",
            "usernameIsEmail": true,
            "allowPasswordReset": true,
            "loginBackgroundImage": "assets/img/login.jpg",
            "loginLogoImage": "assets/img/application/umbraco_logo_white.svg",
            "canSendRequiredEmail": false,
            "minimumPasswordLength": 10,
            "minimumPasswordNonAlphaNum": 0
        },
        "isDebuggingEnabled": true,
        "application": {
            "cacheBuster": "2f05ebbea4d8aa5b6abd8a30dd740226c3f4358a",
            "applicationPath": "/cms/"
        },
        "features": {
            "disabledFeatures": {
                "disableTemplates": false
            }
        }
    }
    

    So this seems like a bug in the current routing/link generation, which you can report on the issue tracker and/or create a PR for on https://github.com/umbraco/Umbraco-CMS/.

    But even if this gets fixed (which I expect won't get high priority, as it's not a common/recommended setup), there are other issues you need to deal with:

    • All paths (including 3rd party packages) need to use the application path (e.g. use ~/App_Plugins/... instead of /App_Plugins/...
    • IIS configuration gets inherited from the parent application by default, so you need to make sure this doesn't cause issues

    I would recommend running Umbraco on a subdomain instead or integrate it into the application that's running in the domain root.

  • Dean Smith 2 posts 72 karma points notactivated
    Jan 20, 2022 @ 14:45
    Dean Smith
    0

    Perfect. thanks!

    I created this bug: https://github.com/umbraco/Umbraco-CMS/issues/11891. Until this is fixed we will see if it is possible for us to have a subdomain.

    thanks

Please Sign in or register to post replies

Write your reply to:

Draft