Fiddler/加载和保存用户首选项/扩展
Fiddler / Load and Save User Preferences / extention
我创建了一个运行良好的 Fiddler 扩展。所以我决定添加更多功能,并将用户首选项保存到配置文件中。如果我从它自己的目录 运行 扩展,这很好用。 Eg.I 导航到 C:\Users\richa\Documents\Fiddler2\Scripts,然后 运行 应用程序。
但是,当 Fiddler 运行 来自 c:\Programs...,然后 Fiddler 从我的用户目录中获取扩展时,它失败了。我花了一段时间才找到它,因为它无声无息地失败了,Fiddler 日志中没有任何信息(是的,我调高了冗长程度)
这是错误的屏幕截图:
我通过将调试器附加到 Fiddler 来捕获此问题...因此当它尝试 open/create/write 到文件时使用 System.Configuration 失败。
具体这段代码:
if (_Configuration == null)
{
// Get the current configuration file.
_Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
}
// Add the custom section to the application
// configuration file.
if (_Configuration.Sections[nameof(WebHookParameterSection)] == null)
{
_Configuration.Sections.Add(nameof(WebHookParameterSection), _WebHookConfiguration);
// Save the application configuration file.
_WebConfigurationManagement.SaveWebConfigurationParameters();
}
_WebHookConfiguration = _Configuration.GetSection(nameof(WebHookParameterSection)) as WebHookParameterSection;
所以我想我需要提升对 open/create/write 文件的权限,当 Fiddler 从它的安装目录 运行ning 时的上下文中。但是,运行在管理员模式下使用 Fiddler 并没有帮助。
我的问题是,如何将首选项保存在 Fiddler 扩展中?
如果没有您的扩展代码,很难说到底发生了什么。
交易是 Fiddler 通过反射加载扩展。所以你的扩展最终在 Fiddler 应用程序域中。根据您使用 System.Configuration API 的方式,您将读取存储在 fiddler.exe.config 中的设置或尝试修改它。无论如何你可能真的不想要那个。当 运行 作为管理员的 Fiddler 很可能是 Windows UAC 时,是什么阻止了您这样做。
我创建了一个运行良好的 Fiddler 扩展。所以我决定添加更多功能,并将用户首选项保存到配置文件中。如果我从它自己的目录 运行 扩展,这很好用。 Eg.I 导航到 C:\Users\richa\Documents\Fiddler2\Scripts,然后 运行 应用程序。
但是,当 Fiddler 运行 来自 c:\Programs...,然后 Fiddler 从我的用户目录中获取扩展时,它失败了。我花了一段时间才找到它,因为它无声无息地失败了,Fiddler 日志中没有任何信息(是的,我调高了冗长程度)
这是错误的屏幕截图:
我通过将调试器附加到 Fiddler 来捕获此问题...因此当它尝试 open/create/write 到文件时使用 System.Configuration 失败。
具体这段代码:
if (_Configuration == null)
{
// Get the current configuration file.
_Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
}
// Add the custom section to the application
// configuration file.
if (_Configuration.Sections[nameof(WebHookParameterSection)] == null)
{
_Configuration.Sections.Add(nameof(WebHookParameterSection), _WebHookConfiguration);
// Save the application configuration file.
_WebConfigurationManagement.SaveWebConfigurationParameters();
}
_WebHookConfiguration = _Configuration.GetSection(nameof(WebHookParameterSection)) as WebHookParameterSection;
所以我想我需要提升对 open/create/write 文件的权限,当 Fiddler 从它的安装目录 运行ning 时的上下文中。但是,运行在管理员模式下使用 Fiddler 并没有帮助。
我的问题是,如何将首选项保存在 Fiddler 扩展中?
如果没有您的扩展代码,很难说到底发生了什么。
交易是 Fiddler 通过反射加载扩展。所以你的扩展最终在 Fiddler 应用程序域中。根据您使用 System.Configuration API 的方式,您将读取存储在 fiddler.exe.config 中的设置或尝试修改它。无论如何你可能真的不想要那个。当 运行 作为管理员的 Fiddler 很可能是 Windows UAC 时,是什么阻止了您这样做。