必须设置单例';Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig';
我正在尝试在外部MVC应用程序中使用Umbraco ContentService 在我的控制器中:必须设置单例';Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig';,umbraco,umbraco7,Umbraco,Umbraco7,我正在尝试在外部MVC应用程序中使用Umbraco ContentService 在我的控制器中: var contentService = new ContentService(); var document = contentService.GetById(idofdocumenthere); 我使用providerName=“System.Data.SqlClient将我的umbraco连接字符串放入web.config文件中 这是运行此代码后出现的错误: You must set th
var contentService = new ContentService();
var document = contentService.GetById(idofdocumenthere);
我使用providerName=“System.Data.SqlClient
将我的umbraco连接字符串放入web.config文件中
这是运行此代码后出现的错误:
You must set the singleton 'Umbraco.Core.Persistence.SqlSyntax.SyntaxConfig'
to use an sql syntax provider
Parameter name: SqlSyntaxProvider
我也检查过了,但这不起作用
提前感谢!不要实例化新的ContextService,请使用ApplicationContext.Current.Services.ContentService。您的意思是:
ApplicationContext.Current.Services.ContentService
,但是ApplicationContext.Current总是空的。我该如何解决这个问题?是的,我的意思是.Current!上面已经解决了:-)如果您是runni,它不能为空在webcontext中为空。如果为空,则表示Web应用程序在IIS启动网站时未正确启动!ApplicationContext.Current。