Reputation: 904
I need to switch between http and https during development and deployment.
To do that, I need to make the following changes in web.config:
<behaviors>
<serviceBehaviors>
<behavior name="DirectInstallHelperServiceBehavior">
<!-- need to change to <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"> -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false">
</serviceMetadata>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding>
<!-- need to add the following, but don't know how
<security mode="Transport">
<transport clientCredentialType="Basic"/>
</security>
-->
</binding>
</webHttpBinding>
</bindings>
So I try to add the following lines in Web.Release.config:
<behaviors>
<serviceBehaviors>
<behavior name="DirectInstallHelperServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" xdt:Transform="setAttribute(httpsGetEnabled, httpGetEnabled)" xdt:Locator="Match(name)"></serviceMetadata>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding>
<security mode="Transport" xdt:Transform="InsertAfter(/configuration/system.serviceModel/bindings/webHttpBinding/binding)">
<transport clientCredentialType="Basic"/>
</security>
</binding>
</webHttpBinding>
</bindings>
But I am doing it wrong because when I publish the service to my filesystem, I still see the development http version of web.config. Any help is appreciated.
Upvotes: 0
Views: 3926
Reputation: 43097
Change your xdt:Transform
value to SetAttributes
. And remove xdt:Locator
since there is no name attribute.
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" xdt:Transform="SetAttributes"></serviceMetadata>
Upvotes: 9