ProcessModelConfig' is not accessible in this context because it is 'Private'

  • Thread starter Thread starter Jack Wright
  • Start date Start date
J

Jack Wright

Dear All,
I would like to read the processModel from machine.config.
The following is code I have writte
Dim hConfig As Object =
ConfigurationSettings.GetConfig("system.web/processModel")
But if I try to typecast hConfig with
System.Web.Configuration.ProcessModelConfig I get the following error:
'System.Web.Configuration.ProcessModelConfig' is not accessible in
this context because it is 'Private'.

I would like to access attribute 'responseDeadlockInterval'.

Please help.

TALIA
Many Regards
Sunil
 
You can just grab the value directly by reading the XML:

System.Xml.XmlDocument myConfig = new XmlDocument();

myConfig.Load(Server.MapPath("web.config"));

System.Xml.XmlNodeList pmNodeList =
myConfig.GetElementsByTagName("processModel");

string responseDeadlockInterval =
pmNodeList[0].Attributes["responseDeadlockInterval"].Value;

....
 
Hi Chris,
How do I find the path of machine.config? I want to read the
processmodel from machine.config.

Thanks & Regards
Sunil

Chris Jackson said:
You can just grab the value directly by reading the XML:

System.Xml.XmlDocument myConfig = new XmlDocument();

myConfig.Load(Server.MapPath("web.config"));

System.Xml.XmlNodeList pmNodeList =
myConfig.GetElementsByTagName("processModel");

string responseDeadlockInterval =
pmNodeList[0].Attributes["responseDeadlockInterval"].Value;

...


--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

Jack Wright said:
Dear All,
I would like to read the processModel from machine.config.
The following is code I have writte
Dim hConfig As Object =
ConfigurationSettings.GetConfig("system.web/processModel")
But if I try to typecast hConfig with
System.Web.Configuration.ProcessModelConfig I get the following error:
'System.Web.Configuration.ProcessModelConfig' is not accessible in
this context because it is 'Private'.

I would like to access attribute 'responseDeadlockInterval'.

Please help.

TALIA
Many Regards
Sunil
 
C:\<windows directory/>\Microsoft.NET\Framework\<framework
version/>\CONFIG\machine.config

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

Jack Wright said:
Hi Chris,
How do I find the path of machine.config? I want to read the
processmodel from machine.config.

Thanks & Regards
Sunil

Chris Jackson said:
You can just grab the value directly by reading the XML:

System.Xml.XmlDocument myConfig = new XmlDocument();

myConfig.Load(Server.MapPath("web.config"));

System.Xml.XmlNodeList pmNodeList =
myConfig.GetElementsByTagName("processModel");

string responseDeadlockInterval =
pmNodeList[0].Attributes["responseDeadlockInterval"].Value;

...


--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

Jack Wright said:
Dear All,
I would like to read the processModel from machine.config.
The following is code I have writte
Dim hConfig As Object =
ConfigurationSettings.GetConfig("system.web/processModel")
But if I try to typecast hConfig with
System.Web.Configuration.ProcessModelConfig I get the following error:
'System.Web.Configuration.ProcessModelConfig' is not accessible in
this context because it is 'Private'.

I would like to access attribute 'responseDeadlockInterval'.

Please help.

TALIA
Many Regards
Sunil
 
Dear All,
The following is the workflow I implemented...
1. Declare a function in
//works on multiple runtimes (i.e. Mono and Rotor)
public static string GetFrameworkDirectory()
{
return Path.GetDirectoryName(typeof(object).Assembly.Location);
}
OR
Dim strDir As String = RuntimeEnvironment.GetRuntimeDirectory()

2. Load the machine.config in a xmlDocument
Dim myConfig As System.Xml.XmlDocument = New XmlDocument()
myConfig.Load(strDir2 + "\CONFIG\machine.config")
Dim pmNodeList As System.Xml.XmlNodeList =
myConfig.GetElementsByTagName("processModel")
Dim responseDeadlockInterval As String =
pmNodeList(0).Attributes("responseDeadlockInterval").Value
3. Convert "responseDeadlockInterval" to the interval u want i.e.
mintues or seconds.

I guess this is a right method to do it programatically...

Many Regards
Sunil

Chris Jackson said:
C:\<windows directory/>\Microsoft.NET\Framework\<framework
version/>\CONFIG\machine.config

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

Jack Wright said:
Hi Chris,
How do I find the path of machine.config? I want to read the
processmodel from machine.config.

Thanks & Regards
Sunil

Chris Jackson said:
You can just grab the value directly by reading the XML:

System.Xml.XmlDocument myConfig = new XmlDocument();

myConfig.Load(Server.MapPath("web.config"));

System.Xml.XmlNodeList pmNodeList =
myConfig.GetElementsByTagName("processModel");

string responseDeadlockInterval =
pmNodeList[0].Attributes["responseDeadlockInterval"].Value;

...


--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

Dear All,
I would like to read the processModel from machine.config.
The following is code I have writte
Dim hConfig As Object =
ConfigurationSettings.GetConfig("system.web/processModel")
But if I try to typecast hConfig with
System.Web.Configuration.ProcessModelConfig I get the following error:
'System.Web.Configuration.ProcessModelConfig' is not accessible in
this context because it is 'Private'.

I would like to access attribute 'responseDeadlockInterval'.

Please help.

TALIA
Many Regards
Sunil
 
Back
Top