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)
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.
|
|
|
|
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)
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.
|
|
|
|
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)
|
|
|
|
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)
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.
|
|
|
|
Online Bookmarks Sharing: