このコードで何が間違っていますか? この API に POST リクエストを送信すると、404 エラー ページが表示されます。誰かがこのコードのデバッグを手伝ってくれますか? Rest Api と Twilio の新機能。
using System.Web.Mvc;
using Twilio.TwiML.Mvc;
using Twilio.Mvc;
namespace MVC4Test.Controllers
{
public class HomeController : TwilioController
{
[HttpPost]
public TwiMLResult ActionResult(SmsRequest request)
{
string smsTextType = request.Body;
var response = new Twilio.TwiML.TwilioResponse();
Response.ContentType = "text/xml";
response.Redirect("http://www.google.com");
//Response.ContentEncoding = System.Text.Encoding.UTF8;
//Response.Write(smsTest);
return TwiML(response);
//Response.Close();
}
}
}
これが私のルートです
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}