I ran this query and confirmed I have the Default Tenant record. I can run Angular login page without problem.
The problem occurs only in public mode (Web.Host and Web.Public start together).
I noticed there is a "New Tenant" link on the public page, which directs to a "Tenant SignUp" page.
It seems that I have to set up a new Tenant, or cannot run as "Default" tenant. Is this by design on Public page?
Thank you! I just tried installing Twilio.AspNet.Core. It works! Here is my test controller code:
using Microsoft.AspNetCore.Mvc;
using Twilio.AspNet.Common;
using Twilio.AspNet.Core;
using Twilio.TwiML;
namespace Project.Web.Controllers
{
[Route("api/[controller]/[action]")]
public class SmsController : ProjectControllerBase
{
[HttpPost]
public TwiMLResult ReceiveSms(SmsRequest request)
{
var messagingResponse = new MessagingResponse();
messagingResponse.Message("The Robots: " + request.Body);
return new TwiMLResult(messagingResponse);
}
}
}
It's nice to use Twilio.AspNet.Common.SmsRequest. I can get all info from Twilio by this type.
I also tried to merge the above "ReceiveSms" method into /api/services which is ultimately derived from "AbpServiceBase". It does NOT work there. I cannot use "SmsRequest" as input type. The workaround is using string type of input, such as:
public TwiMLResult ReceiveSms(string from, string body){}
Do you have any idea how to use Twilio type "SmsRequest" as input here?
At least, I got a workaround. Thank you very much!!
I tried that. I created an Controller in Web.Core/Controllers, but I have to inherit ControllerBase, otherwise it cannot be routed, and popup error while the swagger opens. If I inherit ControllerBase, the input header as "--header 'Content-Type: application/json-patch+json'", no mater how I manually set the content-type. Here is my test code:
using Microsoft.AspNetCore.Mvc;
using Twilio.AspNet.Mvc;
using Twilio.Rest.Api.V2010.Account;
using Twilio.TwiML;
using Twilio.TwiML.Messaging;
namespace SNet.Web.Controllers
{
[Route("api/[controller]/[action]")]
public class SmsController : SNetControllerBase
{
private TwilioController m_del;
public static implicit operator TwilioController(SmsController type)
{
return (type.m_del);
}
[HttpPost]
[Produces("text/xml")]
public TwiMLResult ReceiveSms([FromBody] MessageResource request)
{
HttpContext.Response.Headers["Content-Type"] = "text/xml";
HttpContext.Request.Headers["Content-Type"] = "text/xml";
var messagingResponse = new MessagingResponse();
messagingResponse.Message("The Robots are coming! Head for the hills!");
return new TwilioController().TwiML(messagingResponse); //m_del.TwiML(messagingResponse);//m_del always null
}
}
}
I just tried to build an .NET app from scratch. The similar Controller works:
using System.Web.Mvc;
using Twilio.AspNet.Mvc;
using Twilio.TwiML;
namespace TwilioReceiver.Controllers
{
public class SmsController : TwilioController
{
[HttpPost]
public TwiMLResult Index()
{
var messagingResponse = new MessagingResponse();
messagingResponse.Message("Testing...");
return TwiML(messagingResponse);
}
}
}
This API is for 3rd party Twilio to callback. I have to follow Twilio's requirement on input and return type. I wonder how to merge this controller into ASPNETZero package. Can you advise me some thing more?
Thanks,
Not sure what I missed. When use the MyEntity in
IRepository<MyEntity>
, I get compile error: cannot convert to "Abp.Domain.Entities.IEntity<int>".
Do you mean to make entity class like this:
public class MyEntity : Entity<long>{}
It gives out compile error. I can only use :Entity<int> or :Entity.
Can you give me a code example where to put <long>?
thanks,
I have an opposite scenario. I have my own entity "MyUser", which has an "Id" property corresponding to MySQL data type BIGINT(20). "MyUser" class inherent Abp.Domain.Entities.Entity. By convention, I don't need to declare the "Id" in my entity class, but I wonder what type the Abp.Domain.Entities.Entity.Id uses, int32 or int64? in another word, if the "Id" value in MySQL is over int32, does it cause problem? If so, how do I prevent it?
Thanks,
Great! It does the trick! Thank you very much!!!
Yes. I tried that, but if I removed that code, it goes back without detail message to Client side. I still only get the general message "An internal error occurred during request".