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.
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.
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
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.
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.
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.
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.
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:
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
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
Hi Jonathan, Thanks for your reply. I tried it but I am getting the following error: Any idea?
To quote myself
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.
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:
Still same error. :(
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
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
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.
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
is working on a reply...