April 19th, 2011 11:04 PM
#1
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!
April 20th, 2011 01:54 PM
#2
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?
April 21st, 2011 07:40 AM
#3
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.
April 22nd, 2011 03:31 AM
#4
Re: Webservice can't call Registry GetValue function?
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.
April 22nd, 2011 03:42 AM
#5
Re: Webservice can't call Registry GetValue function?
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?
April 22nd, 2011 03:43 AM
#6
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!
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks