Modify ServiceReferences.ClientConfig file using b

2019-09-06 15:02发布

问题:

my team is developing a silverlight application and we are now switching our solution to https on our server but we would like to use http locally. So, in the XAP file that results when building the app there is a ServiceReferences.ClientConfig having the configuration for the web services that are referenced in the project. The issue is that I would like to have some configuration when I am running it locally and have some other configuration when I deploy it. We decided to alter the ServiceReferences.ClientConfig before building because otherwise it would be encapsulated in the .xap file. We are using msbuild in a bat file to deploy the solution. The config file:

<configuration>
    <system.serviceModel>
        <bindings>
            <customBinding>
                <binding name="CustomBinaryBinding">
                  <binaryMessageEncoding />
                  <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
                </binding>
            </customBinding>
        </bindings>
        <client>
          <endpoint address="../../PlatformAdminUtil.svc"
               binding="customBinding" bindingConfiguration="CustomBinaryBinding"
               contract="PlatformAdminUtil.PlatformAdminUtil" name="CustomBinding_PlatformAdminUtil" />
         </client>
    </system.serviceModel>
</configuration>

I wish to change the <httpTransport/> tag into <httpsTransport/>. I'm new on scripting in bat files so I need some help on the script that would manage this.