500 error with Twilio C# REST Api on Azure Staging

2019-09-06 13:02发布

问题:

var client = new TwilioRestClient(ConstantKeys.AccountSid,ConstantKeys.AuthToken); // instantiate a new Twilio Rest Client

var messageCallBack = client.SendMessage(ConstantKeys.SmsEnabledTwilioNumber, mobileNumber, smsMessage);

Above code snippet is working fine on localhost but when we publish and try to use the same on live site we are getting a 500 error.We are using windows azure for hosting our website.It doesn't reach the first line of the above code on production.Can you tell me why ? Any help would be highly appreciated.

Note :I have checked the dlls on published version.It's having below dlls. Twilio.Api.dll and RestSharp.dll

Site link : The Twilio C# Helper Library

回答1:

Twilio evangelist here.

There is a known issue with the Twilio MVC helper library when deployed to a web role that prevents the library from finding the correct ASP.NET MVC dependency.

Right now the work around is to grab the source of the library, update that dependency to ASP.NET MVC 3 or newer and recompile.

Hope that helps.