mbt masai
 
Welcome !
         

                                
After experiencing a lot of down time, We decided to move this site to CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.

 Accessing Web.config in VBScript file

Author Message
jalati

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 6/26/2009
  • Status: offline
Accessing Web.config in VBScript file Friday, June 26, 2009 1:30 AM (permalink)
0
I'm trying to run a .NET command line program from a VBScript file. The program makes a call to a utility with some WCF proxies and needs to access the app.config for endpoint and app settings information.

The code I am trying to execute basically looks like this:

     Dim objResult
 
     Set objShell = WScript.CreateObject("WScript.Shell")	
     objResult = objShell.Run("MyProgram " & strUsername & " 0", 1, True)
 
     ' Some code to handle the result in case of an error
 


The program executes (launches) just fine. The command line arguments getting passed in correctly, however I don't believe the app.config (MyProgram.exe.config) is being accessed properly when run from the shell. The app.config is in the same directory as the script and the program and when I run the program by itself, it works fine.

I've tried moving the app.config into WINDOWS\system32 and WINDOWS\system32\inetsrv. And in the latter case, I've also renamed the app.config to w3wp.exe.config and dllhost.exe.confg because of some Googling.

The other catch here is that the VBScript and the program live on the L: drive and Windows is installed on the T: drive (no idea why).

Any ideas?

Thanks.
#1
    jalati

    • Total Posts : 2
    • Scores: 0
    • Reward points : 0
    • Joined: 6/26/2009
    • Status: offline
    RE: Accessing Web.config in VBScript file Friday, June 26, 2009 5:15 AM (permalink)
    0
    After some further debugging, it looks as though the program (MyProgram.exe) is able to access the app.config, however the issue appears to be connecting to Active Directory.

    Further explanation:

    The program is passed two arguments via the command line. The first argument is used to search AD for a user and return the value of an attribute (or DirectoryEntry.Property in .NET). This attribute and the second command line argument are used to create a DTO (Data Transfer Object) which is used by the WCF service call.

    If I can't find the user in AD (because it doesn't exist or there is some error related to Active Directory), the WCF service call never occurs.

    The server where this script is hosted has access to the AD domain (they're the same and running the program explicitly exhibits the correct behavior -- results and debugging statements confirm this). However, something just doesn't appear to be correct when I run it via the WScript.Shell object.

    Would it have something to do with the option I am using (option 1 in my above code example, normally it would be 6 in production).

    Thanks.
    #2
      qingren

      • Total Posts : 4
      • Scores: 0
      • Reward points : 0
      • Joined: 8/4/2009
      • Status: offline
      RE: Accessing Web.config in VBScript file Tuesday, August 04, 2009 6:51 PM (permalink)
      0
      I hava the same problem.

      ________________________________________
      My site:
      Michael Jackson jordan shoes
      #3
        ebgreen

        • Total Posts : 8088
        • Scores: 95
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: offline
        RE: Accessing Web.config in VBScript file Wednesday, August 05, 2009 12:48 AM (permalink)
        0
        I am not an ASP guy, but my first guess would be that the user context that the script is running under (ASP service account maybe?) does not have AD permissions.
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.8
          mbt shoes www.wileywilson.com