Ask a Question related to ASP.NET Web Services, Design and Development.
-
james #1
reading Web.config with ConfigurationSetting HELP??
I have a Winforms app and a WebService. When the win app calls
the service, the service reads the config file like so
ConfigurationSettings.AppSettings["myKey"]
but, the WebService is getting the app.config from the win app
NOT the Web.config settings.
Read:: Accessing ASP.NET Configuration Settings and it states to
use ConfigurationSettings.AppSettings, so why wont it read Web.config ?
thanks,
JIM
james Guest
-
Reading Values from Machine.config in ASP.NET
How can i read values from Machine.config From ASP.NET -
Error loading XML file c:\windows\microsoft.net\framework\v1.0.3705\Config\machine.config
I had many ASP.NET web applications that I created before I had to rebuild my machine. After a fresh install of XP Pro, VS.NET 2003, etc, I now... -
config file: a) what Module ? b) conditionals in config (for multiple hosts)
Hi, a) I am looking for a module to handle config files. There are a number of these modules, like AppCconig. Any consensus about The Right... -
[RCR] Include CONFIG::Config['rubydocdir'] in rbconfig.rb
Hi folks, I apologise if people have read this RCR and are not interested, but this is what I consider to be an important RCR, not a merely... -
Intermittent problem reading appSettings in Web.Config
Are you positive this is a web config issue? You yourself say you don't know what is being returned. When you resave web.config, this restarts... -
Jan Tielens #2
Re: reading Web.config with ConfigurationSetting HELP??
Are you sure you are accessing the webservice through SOAP? The webservice
indeed should read the web.config file! I'm pretty sure it does (normally)
because I've done this numerous times...
In fact I don't think it's possible due to a number of issues (security,
application boundaries, ...).
--
Greetz
Jan Tielens
________________________________
Read my weblog: [url]http://weblogs.asp.net/jan[/url]
"james" <nospam@hypercon.net> wrote in message
news:eGvQmiY8DHA.1636@TK2MSFTNGP12.phx.gbl...> I have a Winforms app and a WebService. When the win app calls
> the service, the service reads the config file like so
>
> ConfigurationSettings.AppSettings["myKey"]
>
> but, the WebService is getting the app.config from the win app
> NOT the Web.config settings.
>
> Read:: Accessing ASP.NET Configuration Settings and it states to
> use ConfigurationSettings.AppSettings, so why wont it read Web.config ?
>
> thanks,
>
> JIM
>
>
>
>
>
Jan Tielens Guest
-
james #3
Re: reading Web.config with ConfigurationSetting HELP??
Well, I follow the MS example on creating an WebService. Simply reference
the web service and call the properties in the object like so
value = MyWebService.MyObject.SomeStaticProperty()
now inside SomeStaticProperty() I do this
public class Util : System.Web.Services.WebService
{
....
[WebMethod(Description="Does something", EnableSession=false)]
public static string SomeStaticProperty()
{
return ConfigurationSettings.AppSettings["SomeValue"];
}
and the XML in Web.config
.....
<appSettings>
<add key="SomeValue" value="xxxxx" />
</appSettings>
thanks for the help
"Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
news:eLQgw0i8DHA.1672@TK2MSFTNGP12.phx.gbl...> Are you sure you are accessing the webservice through SOAP? The webservice
> indeed should read the web.config file! I'm pretty sure it does (normally)
> because I've done this numerous times...
>
> In fact I don't think it's possible due to a number of issues (security,
> application boundaries, ...).
>
> --
> Greetz
>
> Jan Tielens
> ________________________________
> Read my weblog: [url]http://weblogs.asp.net/jan[/url]
>
>
> "james" <nospam@hypercon.net> wrote in message
> news:eGvQmiY8DHA.1636@TK2MSFTNGP12.phx.gbl...>> > I have a Winforms app and a WebService. When the win app calls
> > the service, the service reads the config file like so
> >
> > ConfigurationSettings.AppSettings["myKey"]
> >
> > but, the WebService is getting the app.config from the win app
> > NOT the Web.config settings.
> >
> > Read:: Accessing ASP.NET Configuration Settings and it states to
> > use ConfigurationSettings.AppSettings, so why wont it read Web.config ?
> >
> > thanks,
> >
> > JIM
> >
> >
> >
> >
> >
>
james Guest
-
Jan Tielens #4
Re: reading Web.config with ConfigurationSetting HELP??
How do you call that static property?
--
Greetz
Jan Tielens
________________________________
Read my weblog: [url]http://weblogs.asp.net/jan[/url]
"james" <nospam@hypercon.net> wrote in message
news:eSYRdak8DHA.1640@TK2MSFTNGP11.phx.gbl...reference> Well, I follow the MS example on creating an WebService. Simplywebservice> the web service and call the properties in the object like so
>
> value = MyWebService.MyObject.SomeStaticProperty()
>
> now inside SomeStaticProperty() I do this
>
> public class Util : System.Web.Services.WebService
> {
>
> ...
> [WebMethod(Description="Does something", EnableSession=false)]
> public static string SomeStaticProperty()
> {
> return ConfigurationSettings.AppSettings["SomeValue"];
> }
>
>
> and the XML in Web.config
>
> ....
> <appSettings>
> <add key="SomeValue" value="xxxxx" />
> </appSettings>
>
>
> thanks for the help
>
>
>
> "Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
> news:eLQgw0i8DHA.1672@TK2MSFTNGP12.phx.gbl...> > Are you sure you are accessing the webservice through SOAP? The(normally)> > indeed should read the web.config file! I'm pretty sure it does?> > because I've done this numerous times...
> >
> > In fact I don't think it's possible due to a number of issues (security,
> > application boundaries, ...).
> >
> > --
> > Greetz
> >
> > Jan Tielens
> > ________________________________
> > Read my weblog: [url]http://weblogs.asp.net/jan[/url]
> >
> >
> > "james" <nospam@hypercon.net> wrote in message
> > news:eGvQmiY8DHA.1636@TK2MSFTNGP12.phx.gbl...> > > I have a Winforms app and a WebService. When the win app calls
> > > the service, the service reads the config file like so
> > >
> > > ConfigurationSettings.AppSettings["myKey"]
> > >
> > > but, the WebService is getting the app.config from the win app
> > > NOT the Web.config settings.
> > >
> > > Read:: Accessing ASP.NET Configuration Settings and it states to
> > > use ConfigurationSettings.AppSettings, so why wont it read Web.config>> >> > >
> > > thanks,
> > >
> > > JIM
> > >
> > >
> > >
> > >
> > >
> >
>
Jan Tielens Guest
-
james #5
Re: reading Web.config with ConfigurationSetting HELP??
Jan,
See below, the line that says this::> > value = MyWebService.MyObject.SomeStaticProperty()
is this wrong ?
thanks,
JIM
"Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
news:#0WivpF9DHA.3292@TK2MSFTNGP11.phx.gbl...(security,> How do you call that static property?
>
> --
> Greetz
>
> Jan Tielens
> ________________________________
> Read my weblog: [url]http://weblogs.asp.net/jan[/url]
>
>
> "james" <nospam@hypercon.net> wrote in message
> news:eSYRdak8DHA.1640@TK2MSFTNGP11.phx.gbl...> reference> > Well, I follow the MS example on creating an WebService. Simply> webservice> > the web service and call the properties in the object like so
> >
> > value = MyWebService.MyObject.SomeStaticProperty()
> >
> > now inside SomeStaticProperty() I do this
> >
> > public class Util : System.Web.Services.WebService
> > {
> >
> > ...
> > [WebMethod(Description="Does something", EnableSession=false)]
> > public static string SomeStaticProperty()
> > {
> > return ConfigurationSettings.AppSettings["SomeValue"];
> > }
> >
> >
> > and the XML in Web.config
> >
> > ....
> > <appSettings>
> > <add key="SomeValue" value="xxxxx" />
> > </appSettings>
> >
> >
> > thanks for the help
> >
> >
> >
> > "Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
> > news:eLQgw0i8DHA.1672@TK2MSFTNGP12.phx.gbl...> > > Are you sure you are accessing the webservice through SOAP? The> (normally)> > > indeed should read the web.config file! I'm pretty sure it does> > > because I've done this numerous times...
> > >
> > > In fact I don't think it's possible due to a number of issuesWeb.config> > > application boundaries, ...).
> > >
> > > --
> > > Greetz
> > >
> > > Jan Tielens
> > > ________________________________
> > > Read my weblog: [url]http://weblogs.asp.net/jan[/url]
> > >
> > >
> > > "james" <nospam@hypercon.net> wrote in message
> > > news:eGvQmiY8DHA.1636@TK2MSFTNGP12.phx.gbl...
> > > > I have a Winforms app and a WebService. When the win app calls
> > > > the service, the service reads the config file like so
> > > >
> > > > ConfigurationSettings.AppSettings["myKey"]
> > > >
> > > > but, the WebService is getting the app.config from the win app
> > > > NOT the Web.config settings.
> > > >
> > > > Read:: Accessing ASP.NET Configuration Settings and it states to
> > > > use ConfigurationSettings.AppSettings, so why wont it read> ?>> >> > > >
> > > > thanks,
> > > >
> > > > JIM
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
>
james Guest
-
Jan Tielens #6
Re: reading Web.config with ConfigurationSetting HELP??
Aah, I see the problem! I think you are using your web service directly. You
should add a web reference to your web service (not a normal reference) and
then use the following code:
Dim s As New referenceName.MyObject
value = s.SomeStaticProperty
Also, I think the static keyword doesn't make any sense when using a web
service:
public static string SomeStaticProperty()
should be
public string SomeStaticProperty()
--
Greetz
Jan Tielens
________________________________
Read my weblog: [url]http://weblogs.asp.net/jan[/url]
"james" <nospam@hypercon.net> wrote in message
news:uMkmXGK9DHA.2944@TK2MSFTNGP11.phx.gbl...> Jan,
>
> See below, the line that says this::>> > > value = MyWebService.MyObject.SomeStaticProperty()
>
> is this wrong ?
>
> thanks,
>
> JIM
>
>
> "Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
> news:#0WivpF9DHA.3292@TK2MSFTNGP11.phx.gbl...> (security,> > How do you call that static property?
> >
> > --
> > Greetz
> >
> > Jan Tielens
> > ________________________________
> > Read my weblog: [url]http://weblogs.asp.net/jan[/url]
> >
> >
> > "james" <nospam@hypercon.net> wrote in message
> > news:eSYRdak8DHA.1640@TK2MSFTNGP11.phx.gbl...> > reference> > > Well, I follow the MS example on creating an WebService. Simply> > webservice> > > the web service and call the properties in the object like so
> > >
> > > value = MyWebService.MyObject.SomeStaticProperty()
> > >
> > > now inside SomeStaticProperty() I do this
> > >
> > > public class Util : System.Web.Services.WebService
> > > {
> > >
> > > ...
> > > [WebMethod(Description="Does something", EnableSession=false)]
> > > public static string SomeStaticProperty()
> > > {
> > > return ConfigurationSettings.AppSettings["SomeValue"];
> > > }
> > >
> > >
> > > and the XML in Web.config
> > >
> > > ....
> > > <appSettings>
> > > <add key="SomeValue" value="xxxxx" />
> > > </appSettings>
> > >
> > >
> > > thanks for the help
> > >
> > >
> > >
> > > "Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
> > > news:eLQgw0i8DHA.1672@TK2MSFTNGP12.phx.gbl...
> > > > Are you sure you are accessing the webservice through SOAP? The> > (normally)> > > > indeed should read the web.config file! I'm pretty sure it does> > > > because I've done this numerous times...
> > > >
> > > > In fact I don't think it's possible due to a number of issues> Web.config> > > > application boundaries, ...).
> > > >
> > > > --
> > > > Greetz
> > > >
> > > > Jan Tielens
> > > > ________________________________
> > > > Read my weblog: [url]http://weblogs.asp.net/jan[/url]
> > > >
> > > >
> > > > "james" <nospam@hypercon.net> wrote in message
> > > > news:eGvQmiY8DHA.1636@TK2MSFTNGP12.phx.gbl...
> > > > > I have a Winforms app and a WebService. When the win app calls
> > > > > the service, the service reads the config file like so
> > > > >
> > > > > ConfigurationSettings.AppSettings["myKey"]
> > > > >
> > > > > but, the WebService is getting the app.config from the win app
> > > > > NOT the Web.config settings.
> > > > >
> > > > > Read:: Accessing ASP.NET Configuration Settings and it states to
> > > > > use ConfigurationSettings.AppSettings, so why wont it read>> > ?> >> > > > >
> > > > > thanks,
> > > > >
> > > > > JIM
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Jan Tielens Guest
-
james #7
Re: reading Web.config with ConfigurationSetting HELP??
Jan,
I changed the methods to non static, and instantiated my webservice i.e.
C#
MyWebSevice.MyUtility utility = new MyWebSevice.MyUtility();
so now the calls look like this
string setting = utility.GetSomeAppSetting();
but guess what ? It still gets the app setting from the calling app
not the Web.config !
Sorry, any other ideas??
MVP ???
thanks for your help
JIM
"Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
news:ez#0LTS9DHA.1632@TK2MSFTNGP12.phx.gbl...You> Aah, I see the problem! I think you are using your web service directly.and> should add a web reference to your web service (not a normal reference)> then use the following code:
>
> Dim s As New referenceName.MyObject
> value = s.SomeStaticProperty
>
> Also, I think the static keyword doesn't make any sense when using a web
> service:
> public static string SomeStaticProperty()
> should be
> public string SomeStaticProperty()
> --
> Greetz
>
> Jan Tielens
> ________________________________
> Read my weblog: [url]http://weblogs.asp.net/jan[/url]
>
>
> "james" <nospam@hypercon.net> wrote in message
> news:uMkmXGK9DHA.2944@TK2MSFTNGP11.phx.gbl...>> > Jan,
> >
> > See below, the line that says this::> >> > > > value = MyWebService.MyObject.SomeStaticProperty()
> >
> > is this wrong ?
> >
> > thanks,
> >
> > JIM
> >
> >
> > "Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
> > news:#0WivpF9DHA.3292@TK2MSFTNGP11.phx.gbl...> > (security,> > > How do you call that static property?
> > >
> > > --
> > > Greetz
> > >
> > > Jan Tielens
> > > ________________________________
> > > Read my weblog: [url]http://weblogs.asp.net/jan[/url]
> > >
> > >
> > > "james" <nospam@hypercon.net> wrote in message
> > > news:eSYRdak8DHA.1640@TK2MSFTNGP11.phx.gbl...
> > > > Well, I follow the MS example on creating an WebService. Simply
> > > reference
> > > > the web service and call the properties in the object like so
> > > >
> > > > value = MyWebService.MyObject.SomeStaticProperty()
> > > >
> > > > now inside SomeStaticProperty() I do this
> > > >
> > > > public class Util : System.Web.Services.WebService
> > > > {
> > > >
> > > > ...
> > > > [WebMethod(Description="Does something", EnableSession=false)]
> > > > public static string SomeStaticProperty()
> > > > {
> > > > return ConfigurationSettings.AppSettings["SomeValue"];
> > > > }
> > > >
> > > >
> > > > and the XML in Web.config
> > > >
> > > > ....
> > > > <appSettings>
> > > > <add key="SomeValue" value="xxxxx" />
> > > > </appSettings>
> > > >
> > > >
> > > > thanks for the help
> > > >
> > > >
> > > >
> > > > "Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
> > > > news:eLQgw0i8DHA.1672@TK2MSFTNGP12.phx.gbl...
> > > > > Are you sure you are accessing the webservice through SOAP? The
> > > webservice
> > > > > indeed should read the web.config file! I'm pretty sure it does
> > > (normally)
> > > > > because I've done this numerous times...
> > > > >
> > > > > In fact I don't think it's possible due to a number of issues> > Web.config> > > > > application boundaries, ...).
> > > > >
> > > > > --
> > > > > Greetz
> > > > >
> > > > > Jan Tielens
> > > > > ________________________________
> > > > > Read my weblog: [url]http://weblogs.asp.net/jan[/url]
> > > > >
> > > > >
> > > > > "james" <nospam@hypercon.net> wrote in message
> > > > > news:eGvQmiY8DHA.1636@TK2MSFTNGP12.phx.gbl...
> > > > > > I have a Winforms app and a WebService. When the win app calls
> > > > > > the service, the service reads the config file like so
> > > > > >
> > > > > > ConfigurationSettings.AppSettings["myKey"]
> > > > > >
> > > > > > but, the WebService is getting the app.config from the win app
> > > > > > NOT the Web.config settings.
> > > > > >
> > > > > > Read:: Accessing ASP.NET Configuration Settings and it states to
> > > > > > use ConfigurationSettings.AppSettings, so why wont it read> >> > > ?
> > > > > >
> > > > > > thanks,
> > > > > >
> > > > > > JIM
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
james Guest



Reply With Quote

