[英]Getting error 405 method not allowed when calling CreateDirectConversationAsync
Any attempt to call the methods 尝试调用方法
Task<ConversationResourceResponse> ConnectorClient.Conversations.CreateConversationAsync(ConversationParameters)
Task<ConversationResourceResponse> ConnectorClient.Conversations.CreateDirectConversationAsync(ChannelAccount, ChannelAccount)
Against endpoint: http://email.botframework.com/ 针对端点: http : //email.botframework.com/
fails with HTTP failure 405 method not allowed. 失败,不允许HTTP故障405方法。
Code snippet 程式码片段
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);
I could not find any documentation that indicated the exact email channel endpoint, so I used the endpoint here , that looked like it was for skype, and replaced skype
with email
. 我找不到任何指示确切的电子邮件渠道端点的文档,因此我在这里使用了端点,看起来像是用于skype的,并用
email
替换了skype
。 I noticed the caveat about not relying on the serviceUrl being stable, but I'm not sure what to pick if I'm trying to start a new conversation without any incoming message. 我注意到有关不依赖serviceUrl保持稳定的警告,但是如果我尝试在没有任何传入消息的情况下开始新的对话,我不确定该选择什么。 If that is the problem.
如果那是问题。
You must add trusted service url : 您必须添加受信任的服务网址:
MicrosoftAppCredentials.TrustServiceUrl(serviceUrl);
After that, your constructor should be : 之后,您的构造函数应为:
var connector = new ConnectorClient(new Uri(serviceUrl), microsoftAppId: appdId, microsoftAppPassword: appPassword);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.