Link to home
Start Free TrialLog in
Avatar of cmtascoli
cmtascoliFlag for United States of America

asked on

Can't enable ASP.NET web service extension in InstallShield project

Hi folks,

I have an InstallShield project that needs to enable the ASP.NET v2.0 Web Service Extension in IIS 6.0  The code appropriately searched the list of extensions, finds ASP.NET v2.0.50727 and determines that it's not yet enabled.  But when it attempts to run the simple vbscript style code to enable it, I get an error "The RPC server is unavailable".  I've run relatively the same code in vbscript and it works fine...so i'm wondering if my syntax needs to be different when using InstallScript (InstallShield's coding language inside the project).  I could farm this work out to a vbscript file outside of the project but would rather keep it inside since it's a relatively simple code of scripting (withstanding the fact that i can't get it to work!!!).  Here's what i have in InstallScript.  The bolded line is where the error occurs.  Any advice will be greatly appreciated.  Thanks!

//////////////////////////////////////////////////////////////////////////
//
//  Function:      EnableAspNetWebExt                                                  
//
//      Parameters:      <None>
//                                                                  
//  Purpose:      This function will set ASP.NET web extension in IIS if not  
//                        done already
//                                                                          
//////////////////////////////////////////////////////////////////////////
function EnableAspNetWebExt()

      BOOL   bFound;
      LIST   listWebExts;
      NUMBER n, nArrSize, nFound, nResult;
      STRING sEnabled, sArrWebSvcExt();
      OBJECT objIIS;    
      
begin
      //initialize array counter
      n = 0;  
      
      //initialize boolean
      bFound = FALSE;
      
      //set object to root IIS properties
      set objIIS = CoGetObject("IIS://localhost/W3SVC","");
               
      if (IsObject(objIIS)) then
      
            //build array with IIS Web Service Extension objects
            sArrWebSvcExt = objIIS.Get("WebSvcExtRestrictionList");
            
            //get size of array
            nArrSize = SizeOf (sArrWebSvcExt);
            
            //loop through array
            while ((n < nArrSize) && (!bFound))  
            
                  //search list for our web service extension
                  nFound = StrFind (sArrWebSvcExt(n), "ASP.NET v2.0.50727");
                   if (nFound >= 0) then
                            
                      //found, now extract out 1st char (1 = enabled)
                        StrSub (sEnabled, sArrWebSvcExt(n), 0, 1);        
                  
                  if (sEnabled = "0") then
                        
                              //not enabled yet, enable it
                        objIIS.EnableWebServiceExtension("ASP.NET v2.0.50727");                          objIIS.SetInfo();
                          bFound = TRUE;
                          
                              //debugging
                              Alert("IIS Web Service Extension ASP.NET v2.0.50727 currently disabled.  Enabling now...", INFORMATION);
               
                                 //write log entry
                              _WriteLog("IIS Web Service Extension ASP.NET v2.0.50727 currently disabled.  Enabling now...");
                      
                      elseif (sEnabled = "1") then
                            //already enabled
                            bFound = TRUE;  
                 
                             //debugging
                              Alert("IIS Web Service Extension ASP.NET v2.0.50727 already enabled.  Nothing to do...", INFORMATION);
               
                                 //write log entry
                              _WriteLog("IIS Web Service Extension ASP.NET v2.0.50727 already enabled.  Nothing to do...");
                      
                      else
                            //unknown return value
                      
                            //throw error but don't abort installation
                            ERRMSG = "Unable to determine if IIS Web Service Extension ASP.NET v2.0.50727 is enabled.  Please enable in IIS manually after installation is complete...";
                              ErrorHandler(ERRMSG, INFORMATION, FALSE);
                        endif;
                  endif;                        
                  
                  //get next item in array
                  n = n + 1;
            endwhile;
      else
            //display msg but don't abort installation
            ERRMSG = "Unable to retrieve Web Service Extensions in IIS.  Please verify ASP.NET v2.0.50727 Web Service Extension is enabled after the installation is complete...";
            ErrorHandler(ERRMSG, INFORMATION, FALSE);      
      endif;      
end;
ASKER CERTIFIED SOLUTION
Avatar of cmtascoli
cmtascoli
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cmtascoli

ASKER

No other solutions were offered up by the time I was able to solve it myself  :-)