我使用了一个基于ASP.NET Framework版本4.5.1的MVC Web应用程序。我制作了nopcommercePlugin插件。我正在将版本3.4升级到3.5。
更新后,我遇到了以下错误:
System.TypeLoadException: Could not load type
'RestSharp.HttpBasicAuthenticator' from assembly 'RestSharp,
Version=105.2.1.0, Culture=neutral, PublicKeyToken=null'.
我正在使用
Twilio
发送短信消息:using Twilio;
public bool MethodName(string FromNumber, string ToNumber, string URL, string code = "")
{
if (code == "")
{
//URL = URL.Replace(" ", "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20");
URL = URL.Replace(" ", "%20");
}
else
{
URL = URL + code + " we repeat your code is : " + code;
URL = URL.Replace(" ", "%20");
}
string AccountSid = _SMSProviderSettings.SMSGatewayTwillioAccountSID;
string AuthToken = _SMSProviderSettings.SMSGatewayTwillioAccountAuthToken;
var twilio = new TwilioRestClient(AccountSid, AuthToken);
var options = new CallOptions();
var twimal = new Twilio.TwiML.TwilioResponse();
twimal.Pause(5);
options.To = ToNumber;
options.Url = URL;
options.From = FromNumber;
options.Method = "GET";
var call = twilio.InitiateOutboundCall(options);
if (call != null)
{
if (call.RestException == null)
return true;
}
//error log entry in system log
_logger.InsertLog(LogLevel.Error, call.RestException.Message, call.RestException.Message + " For more detail click here " + call.RestException.MoreInfo);
return false;
}
已安装的版本为:
- Twilio.4.0.5
- Twilio.TwiML.3.3.6
- Twilio.Mvc.3.1.15
- RestSharp.105.1.0
Twilio Nuget
页面的一些讨论。如果我使用RestSharp 105.2.2版本,则会产生以下错误:
![enter image description here](https://istack.dev59.com/21aJV.webp)