调用CreateDirectConversationAsync时不允许获取错误405方法

时间:2017-04-20 20:54:17

标签: c# botframework

任何试图调用方法的尝试

Task<ConversationResourceResponse> ConnectorClient.Conversations.CreateConversationAsync(ConversationParameters)
Task<ConversationResourceResponse> ConnectorClient.Conversations.CreateDirectConversationAsync(ChannelAccount, ChannelAccount)

针对端点:http://email.botframework.com/

因HTTP失败而失败405方法不允许。

代码段

const string emailServiceUrl = "http://email.botframework.com/";
ConnectorClient connector = new ConnectorClient(new Uri(emailServiceUrl));

ChannelAccount botAccount = new ChannelAccount("bot@mail", null);
ChannelAccount userAccount = new ChannelAccount("user@mail", null);

var conversationId = await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount);

我找不到任何指明确切电子邮件渠道端点的文档,因此我使用了端点here,它看起来像是用于Skype,并将skype替换为email。我注意到有关不依赖serviceUrl稳定的警告,但如果我尝试在没有任何传入消息的情况下尝试启动新会话,我不确定该选择什么。如果这是问题。

1 个答案:

答案 0 :(得分:1)

您必须添加受信任的服务网址:

<form name="contactPage" id="contactPage">

var mainElement = document.getElementById('contactPage');
$(mainElement).find('input[type="submit"]')

之后,你的构造函数应该是:

MicrosoftAppCredentials.TrustServiceUrl(serviceUrl);