Twilio 传入消息

Twilio Incoming Message

我无法收到传入的消息,我的回复也没有发回给对方

我在 SmsController 中设置了以下内容

using System;
using System.Net.Mail;
using System.Configuration;
using System.Web.Mvc;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;
using Twilio.AspNet.Common;
using Twilio.TwiML;
using Twilio.AspNet.Mvc;
using Chat.Models;


public class SmsController : TwilioController
{
[HttpPost]
public TwiMLResult ReceiveSms(SmsRequest incomingMessage)
{
    try
    {
        Applicant applicant = new Applicant();
        string Phone = incomingMessage.From;
        string UserID = applicant.GetUserIDByTelephone(Phone);
        string MgrName = applicant.GetMessageSender(UserID);
        string ApplicantName = applicant.GetName(UserID);

        //Get the Message and the MessageID
        string Body = incomingMessage.Body;
        string MessageSid = incomingMessage.SmsSid;

        //Save incoming message in the database
        applicant.IncomingMessage(UserID, Body, MessageSid);

        //Send applicant a message acknowledging that the text was received.
        var response = new MessagingResponse();
        response.Message("Thank you for your response.  We will respond to your message shortly.");

        //Get information on the manager
        Manager manager = new Manager();
        string MgrID = manager.GetMgrID(MgrName);
        string email = manager.GetMgrEmail(MgrID);
        bool notify = manager.Notify(MgrID);

        //Send the email notification if manager set to receive notification.
        if (notify)
        {
            SendEmail(email, ApplicantName, Body);
        }
        return TwiML(response);
    }
    catch (Exception ex)
    {
        Errors.ErrorOccured(ex,"message sent = " + incomingMessage.Body);
        MessagingResponse messagingResponse = new MessagingResponse();
        messagingResponse.Message("oops.. An error has occured.");
        return TwiML(messagingResponse);
    }
}
}

我在 Twilio 中设置了 Webhook

https://www.myUrl/admin/applicantmanagement/Sms/ReceiveSms

以上是这个MVC APP的地址。

但是我没有收到用户的回复

那是我添加 try catch 的时候,因为此行设置为向我发送有关模型或控制器中发生的任何错误的电子邮件

Errors.ErrorOccured(ex,"message sent = " + incomingMessage.Body);

Twilio 文档没有这样显示,但我在同一个控制器中也有我的 SendSms ActionResult,这可能是我的问题吗?

我过得不好url。该应用程序被放置在一个名为 sms 的虚拟目录中,因此实际的 webhook 应该有 benn

https://www.myUrl/admin/applicantmanagement/sms/Sms/ReceiveSms