当我尝试使用 specflow 执行我的功能文件时,我在
throw new ConfigurationErrorsException("Data provider section is not set.");
哪个说
类型为"系统.配置.配置错误异常"的异常 发生在项目中,但未在代码中处理
/// <summary>
/// Reads the configuration related to the set of configuration
/// </summary>
private static void LogInitializer()
{
LogProviderConfiguration configSection = (LogProviderConfiguration)ConfigurationManager.GetSection("LogProviders");
if (configSection == null)
throw new ConfigurationErrorsException("Data provider section is not set.");
_providerCollection = new LogProviderCollection();
ProvidersHelper.InstantiateProviders(configSection.Providers, _providerCollection, typeof(LogProviderBase));
_providerSettings = configSection.Providers;
if (_providerCollection[configSection.DefaultProviderName] == null)
throw new ConfigurationErrorsException("Default data provider is not set.");
_default = _providerCollection[configSection.DefaultProviderName];
var defaultSettings = _providerSettings[configSection.DefaultProviderName];
_default.SetParameters(defaultSettings.Parameters);
}
似乎您在规范流项目中没有配置文件。 请使用日志提供程序部分添加app.confog文件,然后它应该可以工作。