469,927 Members | 1,735 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

path is not of a legal form for FileSystemWatcher if I get path fromAppSettings

Hi,

the following:

FileSystemWatcher watcher = new FileSystemWatcher();
RenderingQ = ConfigurationSettings.AppSettings["RenderingQ"];
//RenderingQ = "C:\\RenditionServerQ\\InjectorQ\\OnDemandQ";
watcher.Path = RenderingQ;

raises the following error:

An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll

Additional information: The path is not of a legal form.

It's somewhat weird because
1. I have tried with both C:\\RenditionServerQ\\InjectorQ\\OnDemandQ
and C:\RenditionServerQ\InjectorQ\OnDemandQ as the value of the
RenderingQ configuration app settings.

2. RenderingQ is declared as a string.

The configuration settings are as follows:

<userSettings>
<WindowsService2.Properties.Settings>
<setting name="RenderingQ" serializeAs="String">
<value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
</setting>
</WindowsService2.Properties.Settings>
</userSettings>
If I do the following:

EventLog.WriteEntry(ConfigurationManager.AppSettin gs["RenderingQ"]);
I get a blank entry in the event log. So what's that about?

Jan 7 '08 #1
3 6753
Well, I think that getting a blank in the event log is telling you there is
something wrong with the setting that you are loading. A blank value would
give you an illegal form error for the path on the file system watcher.

"pantagruel" wrote:
Hi,

the following:

FileSystemWatcher watcher = new FileSystemWatcher();
RenderingQ = ConfigurationSettings.AppSettings["RenderingQ"];
//RenderingQ = "C:\\RenditionServerQ\\InjectorQ\\OnDemandQ";
watcher.Path = RenderingQ;

raises the following error:

An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll

Additional information: The path is not of a legal form.

It's somewhat weird because
1. I have tried with both C:\\RenditionServerQ\\InjectorQ\\OnDemandQ
and C:\RenditionServerQ\InjectorQ\OnDemandQ as the value of the
RenderingQ configuration app settings.

2. RenderingQ is declared as a string.

The configuration settings are as follows:

<userSettings>
<WindowsService2.Properties.Settings>
<setting name="RenderingQ" serializeAs="String">
<value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
</setting>
</WindowsService2.Properties.Settings>
</userSettings>
If I do the following:

EventLog.WriteEntry(ConfigurationManager.AppSettin gs["RenderingQ"]);
I get a blank entry in the event log. So what's that about?

Jan 7 '08 #2

Yeah, I suppose there's something wrong as well. But I can't really
see what that is. The setting name is the same as the value I am
passing, certainly looks like it above. I've tried two different path
values.
I've tried with both ConfigurationManager.AppSettings and
ConfigurationSettings.AppSettings,

So the question is why would this as my app settings:

<userSettings>
<WindowsService2.Properties.Settings>
<setting name="RenderingQ" serializeAs="String">
<value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
</setting>
</WindowsService2.Properties.Settings>
</userSettings>

give a blank value for this
ConfigurationManager.AppSettings["RenderingQ"]

On Jan 7, 5:42 pm, Family Tree Mike
<FamilyTreeM...@discussions.microsoft.comwrote:
Well, I think that getting a blank in the event log is telling you there is
something wrong with the setting that you are loading. A blank value would
give you an illegal form error for the path on the file system watcher.

"pantagruel" wrote:
Hi,
the following:
FileSystemWatcher watcher = new FileSystemWatcher();
RenderingQ = ConfigurationSettings.AppSettings["RenderingQ"];
//RenderingQ = "C:\\RenditionServerQ\\InjectorQ\\OnDemandQ";
watcher.Path = RenderingQ;
raises the following error:
An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll
Additional information: The path is not of a legal form.
It's somewhat weird because
1. I have tried with both C:\\RenditionServerQ\\InjectorQ\\OnDemandQ
and C:\RenditionServerQ\InjectorQ\OnDemandQ as the value of the
RenderingQ configuration app settings.
2. RenderingQ is declared as a string.
The configuration settings are as follows:
<userSettings>
<WindowsService2.Properties.Settings>
<setting name="RenderingQ" serializeAs="String">
<value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
</setting>
</WindowsService2.Properties.Settings>
</userSettings>
If I do the following:
EventLog.WriteEntry(ConfigurationManager.AppSettin gs["RenderingQ"]);
I get a blank entry in the event log. So what's that about?
Jan 8 '08 #3
Are you getting any values from your settings that are valid?

If not, try something like the following and see if your code is having
trouble finding the config file.

string[] keys = appSettings.AllKeys;

Console.WriteLine();
Console.WriteLine("Application appSettings:");

// Loop to get key/value pairs.
for (int i = 0; i < appSettings.Count; i++)

Console.WriteLine("#{0} Name: {1} Value: {2}",
i, keys[i], appSettings[i]);

"pantagruel" wrote:
>
Yeah, I suppose there's something wrong as well. But I can't really
see what that is. The setting name is the same as the value I am
passing, certainly looks like it above. I've tried two different path
values.
I've tried with both ConfigurationManager.AppSettings and
ConfigurationSettings.AppSettings,

So the question is why would this as my app settings:

<userSettings>
<WindowsService2.Properties.Settings>
<setting name="RenderingQ" serializeAs="String">
<value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
</setting>
</WindowsService2.Properties.Settings>
</userSettings>

give a blank value for this
ConfigurationManager.AppSettings["RenderingQ"]

On Jan 7, 5:42 pm, Family Tree Mike
<FamilyTreeM...@discussions.microsoft.comwrote:
Well, I think that getting a blank in the event log is telling you there is
something wrong with the setting that you are loading. A blank value would
give you an illegal form error for the path on the file system watcher.

"pantagruel" wrote:
Hi,
the following:
FileSystemWatcher watcher = new FileSystemWatcher();
RenderingQ = ConfigurationSettings.AppSettings["RenderingQ"];
//RenderingQ = "C:\\RenditionServerQ\\InjectorQ\\OnDemandQ";
watcher.Path = RenderingQ;
raises the following error:
An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll
Additional information: The path is not of a legal form.
It's somewhat weird because
1. I have tried with both C:\\RenditionServerQ\\InjectorQ\\OnDemandQ
and C:\RenditionServerQ\InjectorQ\OnDemandQ as the value of the
RenderingQ configuration app settings.
2. RenderingQ is declared as a string.
The configuration settings are as follows:
<userSettings>
<WindowsService2.Properties.Settings>
<setting name="RenderingQ" serializeAs="String">
<value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
</setting>
</WindowsService2.Properties.Settings>
</userSettings>
If I do the following:
EventLog.WriteEntry(ConfigurationManager.AppSettin gs["RenderingQ"]);
I get a blank entry in the event log. So what's that about?
Jan 8 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by eyal | last post: by
10 posts views Thread by Jeff Grantham | last post: by
2 posts views Thread by Mike Johnson | last post: by
1 post views Thread by Fredrik Johansson | last post: by
1 post views Thread by greg_slavin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.