我正在使用Quartz.Server.exe 2.X作为作业执行者。 我正在使用Quartz.Server.exe.config配置quartz。
<quartz >
<add key="quartz.scheduler.instanceName" value="AlyCE_LROScheduler" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz" />
<add key="quartz.jobStore.tablePrefix" value="QUARTZ_" />
<add key="quartz.jobStore.dataSource" value="defaultDS" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.dataSource.defaultDS.provider" value="SqlServer-20" />
<add key="quartz.dataSource.defaultDS.connectionString" value="my connection string to encrypt/decrypt" />
</quartz>
一切正常。现在我想出于安全原因加密连接字符串。
有没有办法让Quartz.Server.exe了解加密连接字符串?
由于
答案 0 :(得分:0)
所以我能够解密我的连接字符串。
所以我的配置看起来像这样:
<quartz >
<!-- thread pool info -->
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<!-- job store info -->
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz" />
<add key="quartz.jobStore.tablePrefix" value="QUARTZ_" />
<add key="quartz.jobStore.dataSource" value="defaultDS" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.dataSource.defaultDS.connectionProvider.type" value="MyDll.MyDbProvider, MyDll" />
</quartz>
<connectionStrings>
<add key="myConnString" connectionString="crypted"/>
</connectionStrings>
然后我创建了新的类库项目,我创建了这个类:
public class MyDbProvider : DbProvider
{
public MyDbProvider() : base("SqlServer-20", MyHelper.GetConnectionString()) { }
}
public static class MyHelper
{
public static string GetConnectionString()
{
//here i decrypt my connection string from app.config file
}
}
MyDll.dll必须位于Quartz.Server.exe的同一目录中。
希望这可以帮助别人!