DSC and IIS web.config

Welcome Forums DSC (Desired State Configuration) DSC and IIS web.config

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 year, 8 months ago.

  • Author
    Posts
  • #65772

    Participant
    Points: 0
    Rank: Member

    Hello,
    I have the web application that needs to be deployed on several nodes located in different datacenter. Therefore web.config on each will have connection string pointing to database located in the same datacenter where node lives. But the question is how I can use test-dscconfiguration to check if web.config resource is in desired state?
    Let me clarify the question a bit.
    The configuration consists of several resources configuring IIS, creating site, pool, copying content and file resource copying web.config from central location. Then script resources changes connection string in web.config so it points to DC local database server. Once configuration is applied, then File resources copying web.config to the node returns "Not in desired state" status and this is true, since web.config was modified by script module and its checksum does not match to original file.
    So what would be a solution to deploy app with DSC and rely on DSCs ability to detect configuration drift?
    I know I can either to switch file resources copying web.config to not use checksum and validate just file existance, but this prevent me from knowing that web.config is changed after deployment.
    Another idea is to have pre-customized web.configs for every data center but this looks like overhead for me and I think there should be more elegant way.
    Am I missing smth? What are best practices to handling mutation of connection string and other nodes individial settings with DSC? Thank you for your ideas!

  • #65883

    Keymaster
    Points: 1,638
    Helping HandTeam Member
    Rank: Community Hero

    Given that web.config is an XML file, it might be easiest to just treat it that way. E.g., write a resource that can load the XML document and validate whatever settings you want. I'd do this versus copying web.config directly. .NET makes XML manipulation pretty straightforward.

  • #65898

    Participant
    Points: 0
    Rank: Member

    Don, thanks a lot for the idea!
    I will try this approach.

The topic ‘DSC and IIS web.config’ is closed to new replies.