Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2011-04-19
2
Medium Priority
?
811 Views
Last Modified: 2012-05-11
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;
0
Comment
Question by:cmtascoli
  • 2
2 Comments
 

Accepted Solution

by:
cmtascoli earned 0 total points
ID: 35776540
Solved.  Googling around, I found a blog where someone used the built in IIS utilty found at c:\windows\system32\iisext.vbs in order to enable the web service.

Eventually the important chunk of code looked like this:

//set program to be called
    sApp = "Cscript.exe";      
   
//set arguments passed into program call
    sArgs = WINDIR ^ "\\system32\\iisext.vbs" + " /EnApp \"" + sWebSvcExt + "\"";                            

if (LaunchAppAndWait(sApp, sArgs, LAAW_OPTION_WAIT|LAAW_OPTION_MINIMIZED) < 0) then
    //display msg but don't abort installation
    ERRMSG = "Unable to determine if IIS Web Service Extension " + sWebSvcExt + " is enabled.  Please enable in IIS manually after installation is complete...";
    ErrorHandler(ERRMSG, INFORMATION, FALSE);
else
    _WriteLog(sWebSvcExt + " Web Service Extension enabled...");
endif;
       
0
 

Author Closing Comment

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

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Integration Management Part 2
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question