我正在尝试将Twilio与我的ASP集成。NET核心MVC应用程序,但在控制器中,我的返回语句中出现错误。
**无法隐式转换类型“系统”。网状物Mvc。ContentResult“给”微软。AspNetCore。Mvc。ContentResult'
**
控制器代码
using Microsoft.AspNetCore.Mvc;
using System.Configuration;
using Twilio;
using Twilio.AspNet.Mvc;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;
using Twilio.TwiML;
namespace TwilioTesting.Controllers
{
public class SMSController : TwilioController
{
public ContentResult Index()
{
var accountSid = "AC12345678";
var authToken = "12345678";
TwilioClient.Init(accountSid, authToken);
var to = new PhoneNumber("+92313887998");
var from = new PhoneNumber("+19898980625");
var message = MessageResource.Create(
to: to,
from: from,
body: "Message from Kamran");
return Content(message.Sid);
}
}
}