Content service (of version 6.13) - calling from external Application
Hello,
We are using Umbraco CMS in our application. we were using version 4.x and used the web service to fetch the cms content in our applicaiton in MVC. We have just upgraded to version 6.1.3.
Now while calling any of the methods from Umbraco.Core.Services.ContentService(), we are getting exception as below
Incorrect syntax near '`'. .Net SqlClient Data Provider
Can you please provide help and guide us for this issue?
Did anyone manage to get this working in an MVC application?
I have been looking for a solution to this problem for many days now, where by I am trying to get a separate/external MVC to successfully be able to access the umbraco CMS data (assuming by using the ContentService). I have spent alot of time with the console application that was made available and attempted to try and "port" this to an MVC project without any luck.
Given the last comments on this were back in August 2013, and Umbraco 7 has now been released. I'm hoping that someone may have some insights into how this might be now possible, and more streamlined. This seems to be a very smart thing to offer and document properly, as in my case having developed many large scale MVC applications, its not ideal to incorporate the CMS into the application itself for a number of reasons.
I would very much appreciate any feedback. I am extremely keen to try and find a solution here, as from what I can tell Umbraco is a great product, however this issue is causing us a real block from moving forward with it.
Did anyone manage to get this working in an MVC application?
I have been looking for a solution to this problem for many days now, where by I am trying to get a separate/external MVC to successfully be able to access the umbraco CMS data (assuming by using the ContentService). I have spent alot of time with the console application that was made available and attempted to try and "port" this to an MVC project without any luck.
Given the last comments on this were back in August 2013, and Umbraco 7 has now been released. I'm hoping that someone may have some insights into how this might be now possible, and more streamlined. This seems to be a very smart thing to offer and document properly, as in my case having developed many large scale MVC applications, its not ideal to incorporate the CMS into the application itself for a number of reasons.
I would very much appreciate any feedback. I am extremely keen to try and find a solution here, as from what I can tell Umbraco is a great product, however this issue is causing us a real block from moving forward with it.
Content service (of version 6.13) - calling from external Application
Hello,
We are using Umbraco CMS in our application. we were using version 4.x and used the web service to fetch the cms content in our applicaiton in MVC. We have just upgraded to version 6.1.3.
Now while calling any of the methods from Umbraco.Core.Services.ContentService(), we are getting exception as below
Incorrect syntax near '`'. .Net SqlClient Data Provider
Can you please provide help and guide us for this issue?
Looking forward to reply.
Thanks.
Hi Nisha,
Have a look at the excellent work from Morten : https://github.com/sitereactor/umbraco-console-example
I manage to get it working by using this marvelous piec of code.
Regards
Hi David,
Thanks for reply.
I have gone through this example. But unfortunately it didn't work at my end.
My applicaiton in MVC, in controller I am getting 'ApplicationContext.Current' always null, so could not follow this example at my end.
So I am using var service = new Umbraco.Core.Services.ContentService(); but while calling method of content service, I am getting exception.
Please provide more elements :
connection string in web.config is as below.
<add name="umbracoDbDSN" connectionString="server=SERVER;Initial Catalog=DBNAME;User Id=USER;Password=PASSWORD" providerName="System.Data.SqlClient" />
--------------------------------------------
And Error is as below.
Incorrect syntax near '`'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass4.<ExecuteReaderWithRetry>b__3()
at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
at Umbraco.Core.Persistence.Database.<Query>d__1c`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Umbraco.Core.Persistence.Repositories.ContentRepository.PerformGet(Int32 id)
at Umbraco.Core.Persistence.Repositories.RepositoryBase`2.Get(TId id)
at Umbraco.Core.Services.ContentService.GetById(Int32 id)
You connection string should contains connection informations to your umbraco database.
Yes, Of cource, Original connection string contains server/database/login credentials. Here SERVER, DBNAME, USER, PASSWORD are replaced only.
Are you able to make the UmbracoConsoleApp to run ?
If you used source code from the application console to init the umbraco context in your application then try to use :
That's the only thing I do in my project.
If it doesn't work then may be it's a bug introduced in 6.1.3 since my solution runs on Umbraco 6.1.2
Regards
I am not sure whether its version issue or not.
But I am getting ApplicationContext.Current always null in my MVC application and its working with console application.
So if consoleApp is working then it's something you forgot to do in your MVC project to initialize the Umbraco context :
I was able to use Umbraco Services in a LINQPad application by correctly instancing the context and keeping config files.
It's quite difficult to know what is going bad on your project ... without access to your source hope you will find your answer.
Hi Nisha,
Did you find what was missing in your MVC project ?
Regards
Hi all,
Did anyone manage to get this working in an MVC application?
I have been looking for a solution to this problem for many days now, where by I am trying to get a separate/external MVC to successfully be able to access the umbraco CMS data (assuming by using the ContentService). I have spent alot of time with the console application that was made available and attempted to try and "port" this to an MVC project without any luck.
Given the last comments on this were back in August 2013, and Umbraco 7 has now been released. I'm hoping that someone may have some insights into how this might be now possible, and more streamlined. This seems to be a very smart thing to offer and document properly, as in my case having developed many large scale MVC applications, its not ideal to incorporate the CMS into the application itself for a number of reasons.
I would very much appreciate any feedback. I am extremely keen to try and find a solution here, as from what I can tell Umbraco is a great product, however this issue is causing us a real block from moving forward with it.
Thanks in advance!
Hi all,
Did anyone manage to get this working in an MVC application?
I have been looking for a solution to this problem for many days now, where by I am trying to get a separate/external MVC to successfully be able to access the umbraco CMS data (assuming by using the ContentService). I have spent alot of time with the console application that was made available and attempted to try and "port" this to an MVC project without any luck.
Given the last comments on this were back in August 2013, and Umbraco 7 has now been released. I'm hoping that someone may have some insights into how this might be now possible, and more streamlined. This seems to be a very smart thing to offer and document properly, as in my case having developed many large scale MVC applications, its not ideal to incorporate the CMS into the application itself for a number of reasons.
I would very much appreciate any feedback. I am extremely keen to try and find a solution here, as from what I can tell Umbraco is a great product, however this issue is causing us a real block from moving forward with it.
Thanks in advance!
Is Umbraco web services potentially the answer?
is working on a reply...