Copied to clipboard

Flag this post as spam?

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


  • Fahad Ayub 71 posts 238 karma points
    Apr 19, 2017 @ 14:16
    Fahad Ayub
    1

    Accessing Memeber service out side of Umbraco app

    Hi, I have a two projects in visual studio one project is website in Umbraco , and other is back-end website where I have to integrate website with our warehouse and finance system. I decided to write back-end in pure MVC as I dont need any content management in back-end. In my backend website I want to access the web site Members. I was wondering it is possible to access Member service in my backend website.

    In my front end website I can access members by using something like:

    var memberService = Services.MemberService;
    

    But in my backend I dont have access to surface controller or any other Umbraco libraries I am not sure if it is possible.

    Thanks

  • Jonathan Richards 288 posts 1742 karma points MVP
    Apr 19, 2017 @ 15:07
    Jonathan Richards
    0

    Hi Fahad

    https://github.com/Isle-Of-Man-Government/IOMG.Umbraco.StandaloneServices

    This will allow you to call Umbraco services from outside Umbraco. These days you need the Umbraco /config/ folder to exist in your MVC project so that the Umbraco core code can load its config values.

    Cheers

    Jonathan

  • Fahad Ayub 71 posts 238 karma points
    Apr 19, 2017 @ 15:28
    Fahad Ayub
    0

    Hi Jonathan, Thanks for your reply. I tried it but I am getting the following error: Any idea?

    Additional information: Could not load the Umbraco.Core.Configuration.UmbracoSettings.IUmbracoSettingsSection from config file, ensure the web.config and umbracoSettings.config files are formatted correctly
    
  • Jonathan Richards 288 posts 1742 karma points MVP
    Apr 19, 2017 @ 15:44
    Jonathan Richards
    0

    To quote myself

    These days you need the Umbraco /config/ folder to exist in your MVC project so that the Umbraco core code can load its config values.

    You are missing the /config/umbracosetting.config file, this needs to be present. You will have to copy this from an Umbraco installation and paste into your MVC project (or whatever it is that is running the Standalone Services).

    Cheers

    EDIT: I should have made it clearer, you need the /config/ folder and all its files (and subfolders) from an Umbraco installation present in your MVC project. Memory serves me about 3 config files aren't' needed, but you will find it quicker to copy them all.

  • Fahad Ayub 71 posts 238 karma points
    Apr 19, 2017 @ 16:20
    Fahad Ayub
    0

    Sorry did everything step by step. Still getting same error. Copied : My project->Umbraco->config also tried My project->Config

    added setting sin app.config:

     <umbracoConfiguration>
        <settings configSource="config\umbracoSettings.config" />
        <BaseRestExtensions configSource="config\BaseRestExtensions.config" />
        <FileSystemProviders configSource="config\FileSystemProviders.config" />
        <dashBoard configSource="config\Dashboard.config" />
      </umbracoConfiguration>
    

    Still same error. :(

  • Jonathan Richards 288 posts 1742 karma points MVP
    Apr 19, 2017 @ 16:26
    Jonathan Richards
    0

    Hi Fahad,

    In the past, what I've done is loaded the Umbraco source code and attached that code to the MVC project to step through the code and see where it is going wrong. But that can be a little fiddle to organise.

    I'm wondering if the MVC project is running from your /bin/debug folder and so it needs the /config/ folder (and all its contents) present in there. So copy /config/ to /bin/debug/config.

    I suppose the best thing I could do is try it myself.

    Cheers

    Jonathan

  • Jonathan Richards 288 posts 1742 karma points MVP
    Apr 19, 2017 @ 16:57
    Jonathan Richards
    1

    Hi Fahad,

    Yeah, I tried to replicate using a fresh MVC project and using Umbraco 7.5.13 config files and yeah, its a mess.

    I normally use StandaloneServives in console apps, so I can run them at 3 in the morning to do stuff. Can I suggest you think about switching to a console app and get your MVC to call the console app when it needs it.

    I do think with enough hitting you can get Standalone Services, Umbraco and MVC to work together, but its not something I want to try right now.

    Sorry for this, I wasn't expecting it to be such a pain.

    Just as a note: Back in Umbraco 6, using Standalone Services was easy, as time has gone along, Umbraco 7 has added more stuff that needs setting up. This has meant that Standalone Services has got harder to use. I did make a fork of Standalone Services that created and used the config files 'virtually', but sadly this isn't in a state that I can publish.

    If you want to give this all up and try a different approach, you can add Restful API to Umbraco website, that you could then call from your MVC site.

    https://github.com/umbraco/UmbracoRestApi

    Sorry for this

    Jonathan

  • Fahad Ayub 71 posts 238 karma points
    Apr 20, 2017 @ 07:42
    Fahad Ayub
    1

    Hi Jonathan, Thanks for all your help. really appreciated. I will have a look at restApi. |For time being I decided to access the database directly through my MVC app.

    Thanks again.

  • Marcio Goularte 374 posts 1346 karma points
    Apr 19, 2017 @ 17:17
    Marcio Goularte
    0

    I have already used the Umbraco Console using the ContentService. Never user or MemberService. I think you should test to see if it works too, know:

    https://github.com/sitereactor/umbraco-console-example

    https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/61746-Accessing-MemberService-and-ContentService-via-console-application

Please Sign in or register to post replies

Write your reply to:

Draft