Service Fabric 和 IConfigurationBuilder
Service Fabric and IConfigurationBuilder
我正在尝试使用 IConfigurationBuilder 来阅读 xml 配置。然而,当服务 运行s(一旦部署)它在这一行失败:
private static void Main()
{
try
{
IConfigurationBuilder Builder = new ConfigurationBuilder(); // Exception here
..
ServiceRuntime.RegisterServiceAsync("MyService.ServiceType",
context => new Service(
context)
.GetAwaiter().GetResult();
在服务器上,我在应用程序日志中看到此异常:
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException at
MyService.Program.Main()
如果我删除此行,它会正常工作。
当我从 VS 本地 运行 服务时,它工作正常。
要在 运行 时加载服务结构设置文件或使用自定义文件作为设置可以使用 ConfigurationProvider class。参考点击here。
我正在尝试使用 IConfigurationBuilder 来阅读 xml 配置。然而,当服务 运行s(一旦部署)它在这一行失败:
private static void Main()
{
try
{
IConfigurationBuilder Builder = new ConfigurationBuilder(); // Exception here
..
ServiceRuntime.RegisterServiceAsync("MyService.ServiceType",
context => new Service(
context)
.GetAwaiter().GetResult();
在服务器上,我在应用程序日志中看到此异常:
Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException at MyService.Program.Main()
如果我删除此行,它会正常工作。
当我从 VS 本地 运行 服务时,它工作正常。
要在 运行 时加载服务结构设置文件或使用自定义文件作为设置可以使用 ConfigurationProvider class。参考点击here。