Webservice can't call Registry GetValue function?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Webservice can't call Registry GetValue function?

  1. #1
    Join Date
    Jul 2010
    Posts
    6

    Unhappy 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!

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,196

    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?

  3. #3
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    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.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  4. #4
    Join Date
    Jul 2010
    Posts
    6

    Re: Webservice can't call Registry GetValue function?

    Quote Originally Posted by Arjay View Post
    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.

  5. #5
    Join Date
    Jul 2010
    Posts
    6

    Re: Webservice can't call Registry GetValue function?

    Quote Originally Posted by darwen View Post
    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?

  6. #6
    Join Date
    Jul 2010
    Posts
    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center