user1618825
user1618825

Reputation:

Custom Config Section in app.config in Windows Service

I added custom config section in web.config MVC Web Project and it is working fine. I did the same in app.config under Windows Service Project and it is throwing error.

The type initializer for 'Quartz.Impl.StdSchedulerFactory' threw an exception

But on removing the custom config section, it is working fine without errors.

<configSections>
<section name="RegisterSchedule" type="Sample.Common.CustomConfig.RegisterScheduleConfig, Sample.Common.CustomConfig" />

  <RegisterSchedule>
    <Schedules>
      <Schedule Name="TestSchedule1" Value="test" IsEnabled="true" />
      <Schedule Name="TestSchedule2" Value="123" IsEnabled="true" />
    </Schedules>
 </RegisterSchedule>

Upvotes: 0

Views: 1175

Answers (1)

user1618825
user1618825

Reputation:

It worked when i moved <configSections> to the top of the app.config next to configuration.

Upvotes: 2

Related Questions