Unable to add wildcard scriptmap on IIS 6.0 programatically

619 views Asked by At

I have created a Web Setup project using VS 2008. I have created a custom action to programatically add a wildcard scriptmap for my virtual directory. The app installs fine, but, during custom action, fails to add scriptmap. I've tried this on Win 2003 server with IIS 6.0 and WinXP with IIS 5.1. I am at my wits end trying to figure out the problem. Here's the VB code I used:

                Dim ScriptMap = "*," + ISAPIPath + ",0,POST"
                Dim de As DirectoryEntry                    
                de = New DirectoryEntry("IIS://LM/W3SVC/1/ROOT/MyApp")    
                de.Properties("ScriptMaps").Add(ScriptMap)
                de.CommitChanges()

A dialogbox appears stating that RPC server is unavailable. I have verified IIS metabase URL using metabase explorer. Any pointers to the problem?

Thanks,
Vamyip

1

There are 1 answers

0
vamyip On BEST ANSWER

Fixed it finally! The problem was with Metabase path. Below is the working code. Wicked little change :)

Dim ScriptMap = "*," + ISAPIPath + ",0,POST"
Dim de As DirectoryEntry                    
de = New DirectoryEntry("IIS://localhost/W3SVC/1/ROOT/MyApp")    ' "LM" replaced with "localhost"
de.Properties("ScriptMaps").Add(ScriptMap)
de.CommitChanges()