【发布时间】:2019-12-06 12:11:02
【问题描述】:
I try to send the SMS from Azure Function, it show the error. But if i do in Web or console app the sms succesfully sent. The error is this:
System.TypeInitializationException:''Nexmo.Api.Configuration' 的类型初始化器抛出异常。'
MissingMethodException:
找不到方法:'Microsoft.Extensions.Configuration.IConfigurationBuilder Microsoft.Extensions.Configuration.MemoryConfigurationBuilderExtensions.AddInMemoryCollection(Microsoft.Extensions.Configuration.IConfigurationBuilder, System.Collections.Generic.IEnumerable1<System.Collections.Generic.KeyValuePair2>)'。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var client = new Nexmo.Api.Client(creds: new Credentials(Api_KEY, Api_Secret));
var results = client.SMS.Send(request: new SMS.SMSRequest()
{
from = nexmo.Sender,
text = nexmo.Msg,
to = nexmo.Receiver
});
【问题讨论】:
-
尝试清理并重建项目。是基于V1还是V2
标签: c# azure-functions nexmo