Copied to clipboard

Flag this post as spam?

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


  • Henrik Sunesen 76 posts 250 karma points
    Aug 25, 2021 @ 18:09
    Henrik Sunesen
    0

    Call surface controller (Cloud project)

    Hi all, i'm trying out the Cloud + VS 2019. I followed the guide on the website (https://our.umbraco.com/documentation/Umbraco-Cloud/Set-Up/Working-With-Visual-Studio/). But I can't work my head around, how to call a surface controller in the .Core project from the .Web project. I've used the UaaS.cmd to clone the projects.

    Screenshot of the solution in VS: https://www.screencast.com/t/vXpSV2mD8o

    In a normal Umbraco solution (not cloud) i can call a controller by the url form "/umbraco/surface/{controllername}/{action}/" But when i call that now i just receive a 404.

    Hope someone can help me on this one :)

  • Alex Skrypnyk (skrypnyk.dev) 6061 posts 23313 karma points MVP 6x admin c-trib
    Aug 26, 2021 @ 09:37
    Alex Skrypnyk (skrypnyk.dev)
    100

    Hi Henrik,

    You have to build .Core project and copy .Core dll to the bin folder of the website to be able to access the surfacecontroller.

    Thanks, Alex

  • Henrik Sunesen 76 posts 250 karma points
    Aug 27, 2021 @ 07:15
    Henrik Sunesen
    1

    Hi Alex,

    You are a star! works perfectly, so the right way to do it is:

    Add a reference from the .Core to the .Web project ( https://www.screencast.com/t/5R4eZBuT4mpa )?

    Is it "best practice" to place the models from the Umbraco ModelsBuilder in the .Core project as well?

  • Alex Skrypnyk (skrypnyk.dev) 6061 posts 23313 karma points MVP 6x admin c-trib
    Aug 27, 2021 @ 10:01
    Alex Skrypnyk (skrypnyk.dev)
    1

    Hi Henrik,

    I prefer to place models in the .Core project, especially if the project is in the active development stage.

    When you need to make changes to the existing project I prefer do not change ModelsBuilder mode, so as it's set in the project I just continue the same way

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft