Install on IIS

jochem4207jochem4207 Posts: 47
edited December 20, 2013 3:11AM in Deployment Manager
Hello Redgate,

I started today with exploring the Deployment manager. I've found lots of awesome stuff but i've problems when rolling out a package to IIS sites.

I don't seem to find a parameter for hostname bindings.

I also get this warning. Maybe it is actually the problem:
2013-12-06 13:58:46 +01:00 INFO   Updating IIS website *sitename*. You can use the RedGateWebSiteName project variable to override an IIS site name. If you don't specify the variable, the package name is used.
2013-12-06 13:58:47 +01:00 WARN   Could not find IIS website *sitename* on the local machine. You can use the RedGateWebSiteName project variable to override an IIS site name or specify a virtual directory. If you don't specify the variable, the package name is used.
2013-12-06 13:58:48 +01:00 INFO   Created an application pool 'Sites' for .NET v4.0

Edit:
I use the variables:
RedGateCreateWebSiteOnPort
RedGateCreateWebSiteApplicationPool
RedGateWebSiteName

Comments

  • csmithcsmith Posts: 138 Bronze 1
    Hi

    Did you create a new release after you added RedGateWebSiteName variable and before you deployed it?

    Releases in Deployment Manager are immutable, which means that you need to create a new release every time you change package steps and variables, for it to affect your deployment.

    While immutability of releases guarantees reliability during deployments, it can be painful when you are changing project configuration!

    Best regards,
    Chris
    Divisional Development Lead
    Redgate Software
  • Thanks for the reply,

    I will check that out soon today.
    Also the a other question came up:

    Is it possible to define redgate variables other than key value pairs. (To replace bigger parts in the config)

    For example:
    <config messageServerUrl = ($CustomRedGateServerUrl$)>
    
    In the variable manager: CustomRedGateServerUrl = "some url"
    
    Greetings,
    Jochem
  • Hi,

    You can use web config transforms for this purpose. Eg. web.Testing.config and web.Production.config, where Testing and Production are matching your environment names. Deployment Manager will apply these at deployment time.

    We'd like to do this in a more elegant way, and there is a UserVoice item for this which you can vote for:

    http://redgate.uservoice.com/forums/176 ... in-config-

    Best wishes,

    Justin
    Justin Caldicott
    Developer
    Redgate Software Ltd
  • Hey,

    I've voted for the uservoice feature. I also see it is a planned feature. Is there any release date availble ?

    Thanks for the fast reply.

    Greets
  • You're welcome.

    Actually we've got a meeting this afternoon where we'll be discussing upcoming work. I've got a proposed solution, but we need to spike a few things first.

    I'll update the UserVoice item as I know more.

    Thanks,

    Justin
    Justin Caldicott
    Developer
    Redgate Software Ltd
  • You're welcome.

    Actually we've got a meeting this afternoon where we'll be discussing upcoming work. I've got a proposed solution, but we need to spike a few things first.

    I'll update the UserVoice item as I know more.

    Thanks,

    Justin

    Hey Justin,

    Is there any news about this idea/issue?


    Edit: About the topicstart.

    When I use RedGateWebsiteName it does give a name to the IIS Site but the host name still keeps empty.

    Like this uservoice: http://redgate.uservoice.com/forums/176 ... te-binding

    Thanks
  • Hi,

    Unfortunately nothing conclusive from that meeting on this specific topic, but I suspect we might not tackle it too soon.

    Did you try using web.config transforms to achieve this?

    The solution I was imagining should also be possible using a predeploy.ps1. If you want to explore it, I was thinking to apply the web deploy parameters.xml concept:
    http://msdn.microsoft.com/en-us/library ... 8(v=vs.110).aspx

    You create a parameters.xml file that is part of your package. That describes the parameters available to configure using name, description and eg. XPath expressions. This way, you can configure anything, quite elegantly from variables in Deployment Manager.

    The challenge I saw was calling the web deploy transformation code from the predeploy.ps1. I'm sure it was in the Microsoft.Web.Publishing.Tasks namespace, in or near the ImportParametersFile class. But I got a little confused about how to create file objects to pass to the Files ITaskItem array.

    Let us know if you make any progress on this.

    Regarding the other UserVoice item, yes I can see how that would be a nice addition. Again, it's not something I expect us to be able to look at right now unfortunately, but do add your votes to the suggestion!

    Best wishes,

    Justin
    Justin Caldicott
    Developer
    Redgate Software Ltd
  • Hey Justin,

    I tried to work on this solution.

    I have a Powershell script that read/edits parameters.xml. After that I want to write a script that does the transformation. (see below)

    I used this example:
    http://stackoverflow.com/questions/8989737/web-config-transforms-outside-of-microsoft-msbuild


    My stackoverflow question: http://stackoverflow.com/questions/2065 ... powershell

    Edit:
    Deleted some questions

    After some more thinking and figuring out i've now
    - edit/save/create a XML (e.g. transform.xml)
    - Powershell script that execute the transformation (code is on stackoverflow)

    After a lot of testing I have one problem:

    In my deploy.ps1 script (i've changed it from pre to deploy) I have the code:


    $LocationMsBuild = msbuild.exe
    $args = transformFile + Name of task
    Start-Process -FilePath $LocationMsBuild -ArgumentList $args | Write-Host

    Transformfile:
    <Project ToolsVersion="4.0" DefaultTargets="Demo" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <UsingTask TaskName="TransformXml"
                              AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>
        <Target Name="Convert">
            <TransformXml Source="Old.Web.config"
                          Transform="transform.xml"
                          Destination="Web.config"/>
        </Target>
    </Project>
    

    When I run deploy.ps1 from powershell i've no issues, when I deploy the package I still don't have any issues but:

    The transformation line doesn't do anything. Is this because of rights that the deployment agent possibly has?

    I know for sure this don't work because it has to create a new web.config file (which doesn't exist at this point). and it won't create it.

    I've print out an error log:
    Microsoft (R) Build Engine version 4.0.30319.18408
    [Microsoft .NET Framework, version 4.0.30319.18408]
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    Build started 12/18/2013 4:18:10 PM.
    Project "D:\Redgate\Api\transformCommand.proj" on node 1 (Convert target(s)).
    Convert:
      Transforming Source File: Old.Web.config
    D:\Redgate\Communited.Timeblockr.Api\transformCommand.proj(5,9): error : Could not open Source file: Could not find file 'D:\Redgate\Communited.Timeblockr.Api\Old.Web.config'.
      Transformation failed
    Done Building Project "D:\Redgate\Api\transformCommand.proj" (Convert target(s)) -- FAILED.
    
    Build FAILED.
    
    "D:\Redgate\Api\transformCommand.proj" (Convert target) (1) ->
    (Convert target) -> 
      D:\Redgate\Api\transformCommand.proj(5,9): error : Could not open Source file: Could not find file 'D:\Redgate\Api\Old.Web.config'.
    
        0 Warning(s)
        1 Error(s)
    
    Time Elapsed 00:00:00.39
    


    Fixed the above problem by deleting the RedG
    Fixed the most of that problems now. By using a defaultlocation

    Two days later I finially have all stuff working :)

    I can now use any redgate variable in any config with
    xdt:Locator="Match()" xdt:Transform="Replace"
    

    For everyone who is missing this option in redgate to replace any variable with redgate variable, I recommend taking a look into the xml functions of powershell



    Greets Jochem
  • We already have built-in support for running environment-specific config transforms during a deployment. These are described at the bottom of this documentation page.
    Development Lead
    Redgate Software
  • Mike Upton wrote:
    We already have built-in support for running environment-specific config transforms during a deployment. These are described at the bottom of this documentation page.

    Hey Mike,

    This is true but i wanted to say that I used a deploy powershell to create a xml file. So I can use all variables anywhere I want. After that I call the transform so it get transformed. But I think I'm going to change this so the redgate environment-specific code does this for me.

    ----

    About the new release it's awesome that we can delete or deploys. This cleans up a lot! Also Happy christmas/holidays
Sign In or Register to comment.