• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

.NET web deployment

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    .NET web deployment

    Long time since I've been here but if anyone can help it would be appreiated.

    I'm currently trying to create an MSI to install a number of web services/components etc and have created an MSI which does just about everything I want. The only problem I have is that I can't find a way of specifying which website on IIS the MSI should set up the all the virtual directories in as it always seems to want to go for the default. Something of a problem when you have a server with multiple sites on different ports.

    Has any one done this before, or does anyone know where I can find an option to set this property. Even better would be if someone knows how to get the MSI to create a new website to put everything in rather than having to get someone to do that first.

    Joe

    #2
    i thought it was possible to install web services data into one place and then kind of provide links to same code from all virtual web servers on that box?

    the MSI bundled with Studio is pretty basic, you might have to invest into proper full blown installer, prices should have fallen by now with so many new entrants in that market

    sorry not much help here

    Comment


      #3
      x

      Installshield Developer has built in support for virtual directories. Otherwise I think you would have to script it in a custom action.

      Comment


        #4
        .net web deployment

        no need for custom scripting just lookup the virtual directory property on your web application folder within the web setup project.......it can be done

        Comment


          #5
          .

          The installer in VS .NET is a solid , industrial strength beast that can do just about everything for deploying .NET and MS components. In your case , I am guessing it may need either the creation of a 'Custom Action' or alternatively as a quick hack create the install from a machine that you have configured such that it is identical to the way you intend to deploy it.

          Comment


            #6
            Thanks for the replies, especially since I don't visit here that often these days.

            Anyway I resolved my problem in the end so I thought I'd post the solution here in case it's something one of you has to do in future.

            The problem as I mentioned was not to do with virtual directories, as this is something that VS.NET copes with quite easily. The main issue was that it always tries to set up the virtual directories on the default web-site, and in turn puts eveything underneath the 'home directory' for that site even though you might want the web components on another drive - a problem if you have more than one running on different ports as may be the case with intranets.

            The solution I found was that before you run the MSI you 'stop' all other websites except the one you want it installed on - or if necessary create a new one - and leave that available on port 80. .NET will then install to the website you want because it's the only one running on the default port (afterwards of course you can change the port settings as required) and voila everything is installed on the drive/website you want.

            If this is something everyone knows already then my apologies for being a simpleton as I couldn't find anything anywhere saying how to do this, and in the end is was simply a mixture of trial and error and educated guess.

            Joe Black

            Comment


              #7
              > MSI you 'stop' all other websites except the one you want it
              > installed on

              you might want to tell your end users CLEARLY before it happens as they might have shock of their life if they run a few websites on their box!

              Comment


                #8
                This may help - how to do it in vbscript - shows the object and how to manipulate it. Don't ask me how to do it in that new fangled .net stuff !


                '---------------------------------------------------------------------------------------------------
                ' This function searches a computer for a specified Web Site, and
                ' displays information about the site.
                '
                ' findweb [--computer|-c COMPUTER]
                ' <--website|-w WEBSITE>
                ' [--help|-?]
                '
                'COMPUTER Computer on which users exists
                'WEBSITE1,WEBSITE2 Virtual Web Sites on which directories will be created
                'NAME1,PATH1,NAME2,PATH2 Virtual Directories names and paths to create
                '
                'Example 1* * * * * * * * mkwebdir -c MyComputer -w "Default Web Site","Another Web Site"
                ' -v "Virtual Dir1","c:\ inetpub\wwwroot\dir1","Virtual Dir2","c:\ inetpub\wwwroot\dir2"
                '
                '---------------------------------------------------------------------------------------------------

                ' Force explicit declaration of all variables.
                Option Explicit

                On Error Resume Next

                Dim oArgs, ArgNum

                Dim ArgComputer, ArgWebSites, ArgVirtualDirs, ArgDirNames(), ArgDirPaths(), DirIndex
                Dim ArgComputers

                Set oArgs = WScript.Arguments
                ArgComputers = Array("LocalHost")
                ArgWebSites = "1"
                ArgNum = 0
                While ArgNum < oArgs.Count
                * * * * Select Case LCase(oArgs(ArgNum))
                * * * * * * * * Case "--computer","-c":
                * * * * * * * * * * * * ArgNum = ArgNum + 1
                * * * * * * * * * * * * If (ArgNum >= oArgs.Count) Then
                * * * * * * * * * * * * * * * * Call DisplayUsage
                * * * * * * * * * * * * End If* * * *
                * * * * * * * * * * * * ArgComputers = Split(oArgs(ArgNum), ",", -1)
                * * * * * * * * Case "--website","-w":
                * * * * * * * * * * * * ArgNum = ArgNum + 1
                * * * * * * * * * * * * If (ArgNum >= oArgs.Count) Then
                * * * * * * * * * * * * * * * * Call DisplayUsage
                * * * * * * * * * * * * End If* * * *
                * * * * * * * * * * * * ArgWebSites = oArgs(ArgNum)
                * * * * * * * * Case "--virtualdir","-v":
                * * * * * * * * * * * * ArgNum = ArgNum + 1
                * * * * * * * * * * * * If (ArgNum >= oArgs.Count) Then
                * * * * * * * * * * * * * * * * Call DisplayUsage
                * * * * * * * * * * * * End If* * * *
                * * * * * * * * * * * * ArgVirtualDirs = Split(oArgs(ArgNum), ",", -1)
                * * * * * * * * Case "--help","-?"
                * * * * * * * * * * * * Call DisplayUsage
                * * * * * * * * Case Else:
                * * * * * * * * * * * * ArgWebSites = oArgs(ArgNum)
                * * * * End Select* * * *

                * * * * ArgNum = ArgNum + 1
                Wend

                Dim foundSite
                Dim compIndex
                Dim bindInfo
                Dim aBinding, binding

                for compIndex = 0 to UBound(ArgComputers)
                * * * * set foundSite = findWeb(ArgComputers(compIndex), ArgWebSites)
                * * * * if isObject(foundSite) then
                * * * * * * * * Trace " Web Site Number = "&foundSite.Name
                * * * * * * * * Trace " Web Site Description = "&foundSite.ServerComment
                * * * * * * * * aBinding=foundSite.ServerBindings
                * * * * * * * * if (IsArray(aBinding)) then
                * * * * * * * * * * * * if aBinding(0) = "" then
                * * * * * * * * * * * * * * * * binding = Null
                * * * * * * * * * * * * else
                * * * * * * * * * * * * * * * * binding = getBinding(aBinding(0))
                * * * * * * * * * * * * end if
                * * * * * * * * else
                * * * * * * * * * * * * if aBinding = "" then
                * * * * * * * * * * * * * * * * binding = Null
                * * * * * * * * * * * * else
                * * * * * * * * * * * * * * * * binding = getBinding(aBinding)
                * * * * * * * * * * * * end if
                * * * * * * * * end if
                * * * * * * * * if (IsArray(binding)) then
                * * * * * * * * * * * * Trace " Hostname = "&binding(2)
                * * * * * * * * * * * * Trace " Port = "&binding(1)
                * * * * * * * * * * * * Trace " IP Address = "&binding(2)
                * * * * * * * * end if
                * * * * else
                * * * * * * * * Trace "No matching web found."
                * * * * end if
                next

                function getBinding(bindstr)

                * * * * Dim one, two, ia, ip, hn
                * * * *
                * * * * one=Instr(bindstr,":")
                * * * * two=Instr((one+1),bindstr,":")
                * * * *
                * * * * ia=Mid(bindstr,1,(one-1))
                * * * * ip=Mid(bindstr,(one+1),((two-one)-1))
                * * * * hn=Mid(bindstr,(two+1))
                * * * *
                * * * * getBinding=Array(ia,ip,hn)
                end function

                Function findWeb(computer, webname)
                * * * * On Error Resume Next

                * * * * Dim websvc, site
                * * * * dim webinfo
                * * * * Dim aBinding, binding

                * * * * set websvc = GetObject("IIS://"&computer&"/W3svc")
                * * * * if (Err <> 0) then
                * * * * * * * * exit function
                * * * * end if
                * * * * ' First try to open the webname.
                * * * * set site = websvc.GetObject("IIsWebServer", webname)
                * * * * if (Err = 0) and (not isNull(site)) then
                * * * * * * * * if (site.class = "IIsWebServer") then
                * * * * * * * * * * * * ' Here we found a site that is a web server.
                * * * * * * * * * * * * set findWeb = site
                * * * * * * * * * * * * exit function
                * * * * * * * * end if
                * * * * end if
                * * * * err.clear
                * * * * for each site in websvc
                * * * * * * * * if site.class = "IIsWebServer" then
                * * * * * * * * * * * * '
                * * * * * * * * * * * * ' First, check to see if the ServerComment
                * * * * * * * * * * * * ' matches
                * * * * * * * * * * * * '
                * * * * * * * * * * * * If site.ServerComment = webname Then
                * * * * * * * * * * * * * * * * set findWeb = site
                * * * * * * * * * * * * * * * * exit function
                * * * * * * * * * * * * End If
                * * * * * * * * * * * * aBinding=site.ServerBindings
                * * * * * * * * * * * * if (IsArray(aBinding)) then
                * * * * * * * * * * * * * * * * if aBinding(0) = "" then
                * * * * * * * * * * * * * * * * * * * * binding = Null
                * * * * * * * * * * * * * * * * else
                * * * * * * * * * * * * * * * * * * * * binding = getBinding(aBinding(0))
                * * * * * * * * * * * * * * * * end if
                * * * * * * * * * * * * else
                * * * * * * * * * * * * * * * * if aBinding = "" then
                * * * * * * * * * * * * * * * * * * * * binding = Null
                * * * * * * * * * * * * * * * * else
                * * * * * * * * * * * * * * * * * * * * binding = getBinding(aBinding)
                * * * * * * * * * * * * * * * * end if
                * * * * * * * * * * * * end if
                * * * * * * * * * * * * if IsArray(binding) then
                * * * * * * * * * * * * * * * * if (binding(2) = webname) or (binding(0) = webname) then
                * * * * * * * * * * * * * * * * * * * * set findWeb = site
                * * * * * * * * * * * * * * * * * * * * exit function
                * * * * * * * * * * * * * * * * End If
                * * * * * * * * * * * * end if
                * * * * * * * * end if
                * * * * next
                End Function

                '---------------------------------------------------------------------------------
                Sub Display(Msg)
                * * * * WScript.Echo Now & ". Error Code: " & Hex(Err) & " - " & Msg
                End Sub

                Sub Trace(Msg)
                * * * * WScript.Echo Msg* * * *
                End Sub

                Sub DisplayUsage()
                * * * * WScript.Echo " findweb [--computer|-c COMPUTER]"
                * * * * WScript.Echo " [WEBSITE]"
                * * * * WScript.Echo " [--help|-?]"
                * * * * WScript.Echo ""
                * * * * WScript.Echo "Finds the named web on the specified computer."
                * * * * WScript.Echo "Displays the site number, description, host name, port,"
                * * * * WScript.Echo "and IP Address"
                * * * * WScript.Echo ""
                * * * * WScript.Echo "Note, WEBSITE is the Web Site on which the directory will be created."
                * * * * WScript.Echo "The name can be specified as one of the following, in the priority specified:"
                * * * * WScript.Echo " Server Number (i.e. 1, 2, 10, etc.)"
                * * * * WScript.Echo " Server Description (i.e ""My Server"")"
                * * * * WScript.Echo " Server Host name (i.e. ""www.domain.com"")"
                * * * * WScript.Echo " IP Address (i.e., 127.0.0.1)"
                * * * * WScript.Echo ""
                * * * * WScript.Echo "Example findweb -c MACHINE www.mycompany.com"
                * * * * WScript.Quit
                End Sub
                '---------------------------------------------------------------------------------

                Comment

                Working...
                X