Facebook C# SDK 错误 'Facebook.WebExceptionWrapper' 类型的异常
Facebook C# SDK Error An exception of type 'Facebook.WebExceptionWrapper'
我正在尝试使用此代码在我的 Facebook 页面上 post,但我收到 exception facebook.webexeptionwrapper
和详细消息 The underlying connection was closed: An unexpected error occurred when sending.
这是我的代码:
public ActionResult Send(FormModel model)
{
const string accesstoken = "myaccesstoken";
dynamic messagePost = new ExpandoObject();
messagePost.access_token = accesstoken;
messagePost.picture = "https://miro.medium.com/max/1200/1*mk1-6aYaf_Bes1E3Imhc0A.jpeg";
messagePost.link = "[SOME_LINK]";
messagePost.name = model.titre;
messagePost.caption = "user" + " this post was created by my website";
messagePost.description = model.description;
FacebookClient app = new FacebookClient(accesstoken);
var result = app.Post("/" + model.pageId + "/feed", messagePost);
return new EmptyResult();
}
我通过将这行代码添加到我的 golabal.asax.cs
来解决
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 |SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | (SecurityProtocolType)3072;
我正在尝试使用此代码在我的 Facebook 页面上 post,但我收到 exception facebook.webexeptionwrapper
和详细消息 The underlying connection was closed: An unexpected error occurred when sending.
这是我的代码:
public ActionResult Send(FormModel model)
{
const string accesstoken = "myaccesstoken";
dynamic messagePost = new ExpandoObject();
messagePost.access_token = accesstoken;
messagePost.picture = "https://miro.medium.com/max/1200/1*mk1-6aYaf_Bes1E3Imhc0A.jpeg";
messagePost.link = "[SOME_LINK]";
messagePost.name = model.titre;
messagePost.caption = "user" + " this post was created by my website";
messagePost.description = model.description;
FacebookClient app = new FacebookClient(accesstoken);
var result = app.Post("/" + model.pageId + "/feed", messagePost);
return new EmptyResult();
}
我通过将这行代码添加到我的 golabal.asax.cs
来解决ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 |SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | (SecurityProtocolType)3072;