can not find schema info when configuration quartz.net - c#

When i add this code to app.config in Windows service program:
<quartz>
<add key="quartz.scheduler.instanceName" value="ExampleDefaultQuartzScheduler"/>
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz"/>
<add key="quartz.threadPool.threadCount" value="10"/>
<add key="quartz.threadPool.threadPriority" value="2"/>
<add key="quartz.jobStore.misfireThreshold" value="60000"/>
<add key="quartz.jobStore.type" value="Quartz.Simpl.RAMJobStore, Quartz"/>
</quartz>
it tips:
Could not find schema information for the element `key`.
Could not find schema information for the attribute `quartz`.
Could not find schema information for the element `value`.
I am sure i have using job_scheduling_data_2_0.xsd file in background.
And predefine the quartz:
<configSections>
<section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
Where is the problem?And where to find the schema info?
And when is the label <quartz> namespace?
Where should i find the xsd file of quartz.net?

Normal reason is your config file lack of schema file like *.xsd in:..\Microsoft Visual Studio\Xml\Schemas folder.
You can omit these tips,it could not affect your program running.
Or you can write the xsd schema file by yourself.

Related

setting up oracle native encryption in web.config file

We need to setup following properties in config file to enable native encryption of oracle
SQLNET.CRYPTO_CHECKSUM_TYPES_CLIENT = (MD5)
SQLNET.ENCRYPTION_TYPES_CLIENT = (AES256)
SQLNET.ENCRYPTION_CLIENT = required
SQLNET.CRYPTO_CHECKSUM_CLIENT = required
Below is the link where I found out it can be done through config file (search for the above properties in link page e.g. ENCRYPTION_CLIENT)
https://docs.oracle.com/cd/E63277_01/win.121/e63268/InstallManagedConfig.htm#ODPNT8164
I was not able to find any good example till now.
Can anyone provide an example or link to see how to enable encryption from config file.
In Configuration section add the below lines.
<configSections>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
Connection String:
<add key="ConnectionString" value="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server name)(PORT=XXXX))(CONNECT_DATA=(SERVICE_NAME=service name)));" />
Add the below section under runtime section:
<oracle.manageddataaccess.client>
<version number="*">
<settings>
<setting name="sqlnet.encryption_types_client" value="aes256" />
<setting name="sqlnet.encryption_client" value="required" />
</settings>
</version>
</oracle.manageddataaccess.client>

Create XSD schema from custom XML file

I have XML looking like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="profile">
<section name="server1" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=a1a1a1a1a1a1a1a1, Custom=null" />
<section name="server2" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=a1a1a1a1a1a1a1a1, Custom=null" />
<section name="server3" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=a1a1a1a1a1a1a1a1, Custom=null" />
</sectionGroup>
</configSections>
<profile>
<server1>
<add key="server" value="serverName1" />
<add key="check" value="0" />
<add key="user" value="sa" />
<add key="psw" value="secret" />
<add key="show" value="1" />
</server1>
<server2>
<add key="server" value="serverName2" />
<add key="check" value="0" />
<add key="user" value="sa" />
<add key="psw" value="secret" />
<add key="show" value="1" />
</server2>
<server3>
<add key="server" value="serverName3" />
<add key="check" value="0" />
<add key="user" value="sa" />
<add key="psw" value="secret" />
<add key="show" value="1" />
</server3>
</profile>
</configuration>
and I would like to create XSD schema for its validation. I have tried it with online XSD generators like https://www.freeformatter.com/xsd-generator.html with any of 3 types of XSD Design but the problem is that validation will not pass if there is any other number of servers in XML beside 3.
Any help or advice for software or other online XSD generators which can account for this randomness is very much appreciated?
There is no way in XSD (other than XSD 1.1 assertions) to say 'the children of this element must be named "server1", "server2", ... "serverN" in order'. XSD is a bit paternalistic like this: it's not designed to describe any XML you might dream up, it's designed to describe well-designed XML. You should drop the digit and call all the elements "server"; or if the digit serves some purpose (e.g. if it's retained after some server elements are deleted from the XML), then make it an attribute value: <server id="server1".../>
I've always found that XSD.exe does a pretty good job. This validator is also pretty good too. On top of that you could try the XML Tools plugin in Notepad++.
With complex XML documents it's often easier to build them up slowly, so start with a simplified version and then gradually add other parts.
This tutorial and this one are both very good and are definitely worth looking at if you're struggling with xsds.
I suggest you have a look at the tutorials and then maybe rethink what you want and restructure your xml accordingly. An obvious first question might be how do server1, server2, and server3 differ? If they're all the same you want three instances of server; if they're different you probably want to capture that somehow in your xml.

How to retrieve the value for the Key in the Web.Config using DictionarySectionHandler

How to fetch the corresponding value of a key that I would get dynamically. I wish to use the system defined DictionarySectionHandler to do the job, of fetching the data from my custom built config section in the Web.config file
Code block in Web.Config
<section name="domainsource" type="System.Configuration.DictionarySectionHandler"/>
<domainSource>
<add key="0" value="170" />
<add key="1" value="171" />
<add key="2" value="172" />
<add key="3" value="173" />
<add key="12" value="174" />
</domainSource>
Sourcecode in the main cs file from where I wish to retrieve the data from the Web.Config
Hashtable statusCodes = ConfigurationManager.GetSection("domainSource") as Hashtable;
vDomainSource = statusCodes[vDomainID];
This is where I am stuck vDomainID would be a value 0/1/2/3/12, based on this value I need to fetch its respective Source from the Web.Config. Any help on this aspect would be really appreciated.
You have a missspelling in the defintion of the section domainsource -> domainSource. Further ensure that the elemnt is defined in an element. Then it should work.
<configuration>
<configSections>
<section name="domainSource" type="System.Configuration.DictionarySectionHandler"/>
</configSections>
<domainSource>
<add key="0" value="170" />
<add key="1" value="171" />
<add key="2" value="172" />
<add key="3" value="173" />
<add key="12" value="174" />
</domainSource>
</configuration>

Paypal: Configuration.GetApiContext -> VS: Cannot resolve Issue

If I install .Net SDK and uses Sample Code, VS says: Cannot resolve symbol 'Configuration' at this line:
var apiContext = Configuration.GetAPIContext();
So, what DLL or namespaces did I missed?
It is a wrapper class around the configuration section.
Please look into \PayPal-NET-SDK-develop\Samples\Source\Utilities\Configuration.cs and create it to suit your configuration.
Don't forget to modify your web.config or app.config
<configSections>
<section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
</configSections>
<!-- PayPal SDK settings -->
<paypal>
<settings>
<add name="mode" value="sandbox" />
<add name="clientId" value="youclientid" />
<add name="clientSecret" value="yoursecret" />
</settings>
</paypal>

can't read variables out of app.config

what I have in app.config is this
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Porject.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
<applicationSettings>
<Porject.Properties.Settings>
<setting name="PhotoLocation" serializeAs="String">
<value>.\photos\</value>
</setting>
</Porject.Properties.Settings>
</applicationSettings>
<connectionStrings>
<add name="****" connectionString="Data Source=***;Initial Catalog=****;User ID=***;Password=***" />
</connectionStrings>
</configuration>
and this is how I call the PhotoLocation:
string s = ConfigurationManager.AppSettings["PhotoLocation"];
When I make a request to get the connectionstring, there is no problem and it works fine; but when I requst the PhotoLocation it returns null.
Also the ConfigurationManager.AppSettings.Count returns 0.
Does anyone have an idea on what I'm doing wrong?
simply add this in your App config file
<appSettings>
<add key="PhotoLocation" value=".\photos\"/>
<appSettings>
ConfigurationManager.AppSettings reads (as the name might suggest) the AppSettings block of your configuration.
Given you've created your own section, you want to use var section = ConfigurationManager.GetSection("Porject.Properties.Settings") and read the values from that section.

Categories

Resources