这是我得到的错误:
Castle.DynamicProxy.InvalidProxyConstructorArgumentsException:无法实例化以下类的代理:SampleAssignment.LeaveApplicationBookingRecognizer。 找不到与给定参数匹配的构造函数: Castle.Proxies.IConfigurationProxy
请帮助我提供一些合适的解决方案。
public class LeaveApplicationBookingRecognizer : IRecognizer
{
private readonly LuisRecognizer _recognizer;
private readonly IConfiguration _configuration;
public LeaveApplicationBookingRecognizer(IConfiguration configuration)
{
_configuration = configuration;
var luisIsConfigured = !string.IsNullOrEmpty(configuration["LuisAppId"]) &&
!string.IsNullOrEmpty(configuration["LuisAPIKey"]) &&
!string.IsNullOrEmpty(configuration["LuisAPIHostName"]);
if (luisIsConfigured)
{
var luisApplication = new LuisApplication(
configuration["LuisAppId"],
configuration["LuisAPIKey"],
"https://" + configuration["LuisAPIHostName"]);
// Set the recognizer options depending on which endpoint version you want to use.
// More details can be found in https://docs.microsoft.com/en-gb/azure/cognitive-
services/luis/luis-migration-api-v3
var recognizerOptions = new LuisRecognizerOptionsV3(luisApplication)
{
PredictionOptions = new Microsoft.Bot.Builder.AI.LuisV3.LuisPredictionOptions
{
IncludeInstanceData = true,
}
};
_recognizer = new LuisRecognizer(recognizerOptions);
}
}
// Returns true if luis is configured in the appsettings.json and initialized.
public virtual bool IsConfigured => _recognizer != null;
public virtual async Task<RecognizerResult> RecognizeAsync(ITurnContext turnContext, CancellationToken cancellationToken)
=> await _recognizer.RecognizeAsync(turnContext, cancellationToken);
public virtual async Task<T> RecognizeAsync<T>(ITurnContext turnContext, CancellationToken cancellationToken)
where T : IRecognizerConvert, new()
=> await _recognizer.RecognizeAsync<T>(turnContext, cancellationToken);
}