Webservice can't call Registry GetValue function?
I use a webservice in order to get and return Registry value.
For explicit more, example follow:
RegistryKey regKey = Registry.CurrentUser.OpenSubKey("Software\\Yahoo\\Pager");
string sUserName = regKey.GetValue("Yahoo! User ID").ToString();
regKey.Close();
I built it by Visual Studio 2005. Debugging-(F5), I can get 'sUserName' variable easily, but I can't get it on a webservice, it throws exception: "Object reference not set to an instance of an object"
Experts can help me in this regard?
Thanks so much in advance!
Re: Webservice can't call Registry GetValue function?
What account is the web service running under?
Is that account the same CurrentUser account that you expect?
Re: Webservice can't call Registry GetValue function?
It's not a good idea to write web services which do this - there are all sorts of pitfalls (web service hosting application login user, permissions).
Instead if you want to pass configuration to a webservice I'd recommend adding them to the web.config file.
Darwen.
Re: Webservice can't call Registry GetValue function?
Quote:
Originally Posted by
Arjay
What account is the web service running under?
Is that account the same CurrentUser account that you expect?
In this demo, I want to get my current yahoo nick by 'sUserName ' variable. 'str' variable is used for getting IIS account type. I tried many different types of Windows accounts to configure for IIS, but it's unsuccessful.
Re: Webservice can't call Registry GetValue function?
Quote:
Originally Posted by
darwen
It's not a good idea to write web services which do this - there are all sorts of pitfalls (web service hosting application login user, permissions).
Instead if you want to pass configuration to a webservice I'd recommend adding them to the web.config file.
Darwen.
What do i need to add to web.config file, could you tell me clearly, pls?
Re: Webservice can't call Registry GetValue function?
Could you tell my mistake, pls?
Link follow: 'http://www.mediafire.com/?y55igzyhc5ob7wk'
Tks you very much!