通过在另一个项目中引用我的 Umbraco 网站 DLL 来发布内容
Publishing content by referencing my Umbraco website DLL in another project
我目前正在研究使用 WCF Web 服务将内容发布到 Umbraco 网站的方法。
在我的 Umbraco 项目 MyWebsite
中,我在实用程序 class 中添加了以下方法:
public static void ContentCreateTest()
{
ContentService cService = new ContentService();
var content = cService.CreateContent("Test Item", 1000, "ContentTypeAlias", 0);
content.SetValue("property1", "Value 1");
content.SetValue("property2", "Value 2");
cService.SaveAndPublishWithStatus(content);
}
我已经添加了对我的 WCF 项目的引用,并且可以调用该函数。
但是,我收到以下错误:
Could not load the Umbraco.Core.Configuration.UmbracoSettings.IUmbracoSettingsSection from config file, ensure the web.config and umbracoSettings.config files are formatted correctly
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
这似乎是由于 WCF 服务无法连接到我的 Umbraco 网站造成的。
从另一个 project/solution 创建 Umbraco 内容的最佳方式是什么?
我认为您应该看一下 REST API。 http://24days.in/umbraco/2015/umbraco-rest-api/:-)
我目前正在研究使用 WCF Web 服务将内容发布到 Umbraco 网站的方法。
在我的 Umbraco 项目 MyWebsite
中,我在实用程序 class 中添加了以下方法:
public static void ContentCreateTest()
{
ContentService cService = new ContentService();
var content = cService.CreateContent("Test Item", 1000, "ContentTypeAlias", 0);
content.SetValue("property1", "Value 1");
content.SetValue("property2", "Value 2");
cService.SaveAndPublishWithStatus(content);
}
我已经添加了对我的 WCF 项目的引用,并且可以调用该函数。
但是,我收到以下错误:
Could not load the Umbraco.Core.Configuration.UmbracoSettings.IUmbracoSettingsSection from config file, ensure the web.config and umbracoSettings.config files are formatted correctly
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
这似乎是由于 WCF 服务无法连接到我的 Umbraco 网站造成的。
从另一个 project/solution 创建 Umbraco 内容的最佳方式是什么?
我认为您应该看一下 REST API。 http://24days.in/umbraco/2015/umbraco-rest-api/:-)