【问题标题】:Post into wordpress blog via C# & WordPressSharp通过 C# 和 WordPressSharp 发布到 wordpress 博客
【发布时间】:2015-04-11 21:09:18
【问题描述】:

我正在使用 WordPressSharp 并尝试将内容添加到我的 wordpress 博客中。

我在添加内容时遇到问题。

Helper.WordpressConfigurations.postToWordpress(1, "testing", "content description");

这是我的发帖方法

public static Post setPost(int postType, string title, string content)
    {
      string type = postType == 1 ? "post" : "page";
      int categoryId = 0;
      switch ("".ToLowerInvariant())
      {
        case "arrow": categoryId = 4; break;
        default: categoryId = 0; break;
      }
      return new Post
      {
        PostType = "post", // "post" or "page"
        Title = title,
        Content = content,
        PublishDateTime = DateTime.Now,
        Status = "publish"//, // "draft" or "publish",
        //Terms = terms
      };
    }

在 WordpressClient.cs 中出现异常 >

我的完整代码在这里http://paste.ubuntu.com/10793675/

【问题讨论】:

    标签: c# wordpress xml-rpc wordpresssharp


    【解决方案1】:

    WordPressSharp 依赖于 xml-rpc.net 版本 3.0.0,它还不是一个稳定的版本,似乎有错误。尝试改用 2.5.0 版本。

    1. wordpresssharp 和 xml-rcp.net 2.5.0 的下载源。
    2. 从 wordpresssharp 项目中删除对 3.0.0 程序集的引用,改为添加对 2.5.0 的引用。

    它在我的情况下有效,我希望它会对你有所帮助。

    【讨论】:

      猜你喜欢
      • 2023-04-10
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-15
      • 1970-01-01
      相关资源
      最近更新 更多