Buscar contenidos

jueves, 27 de abril de 2017

Transformaciones Web.config para cada ambiente


Link de artículo

Paso #1

Paso #2


Paso#3




Ejemplo #1


<configuration> <appSettings> <add key="APIKey" value="5200eb9e591cc4a19178f8fac1c210fc"/> <add key="Secret" value="e957123205f4a7f7a95e2d352bcaf444"/> <add key="ServiceBase" value="http://localhost:49396/"/> <add key="Callback" value="http://localhost:26813/101FTB/"/> </appSettings> <connectionStrings> <add name="MyDBConnectionString" connectionString="Data Source=localhost;Initial Catalog=FreeTechBooks;User ID=Guest" providerName="System.Data.SqlClient"/> </connectionStrings> ... </configuration>



<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <appSettings> <add value="a44a569d89f09862bdeac3e9e7c155aa" xdt:Transform="SetAttributes(value)" xdt:Locator="Condition(@key='APIKey')"/> <add value="9a6e6fbda2558fad51f25b7f62bad80d" xdt:Transform="SetAttributes(value)" xdt:Locator="Condition(@key='Secret')"/> <add value="http://www.mysitelive.com/" xdt:Transform="SetAttributes(value)" xdt:Locator="Condition(@key='ServiceBase')"/> <add value="http://fbapps.mysitelive.com/myapplive/" xdt:Transform="SetAttributes(value)" xdt:Locator="Condition(@key='Callback')"/> </appSettings> <connectionStrings> <add name="MyDBConnectionString" connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> </connectionStrings> <system.web> </system.web> </configuration>


Ejemplo #2

Web.config
<tokenValidatorSection validateTokenSignature="true" certificateStoreName="My" certificateStoreLocation="CurrentUser" />

Web.Debug.config
<tokenValidatorSection validateTokenSignature="true" certificateStoreName="Root" certificateStoreLocation="LocalMachine" xdt:Transform="SetAttributes(certificateStoreName,certificateStoreLocation)"   />

No hay comentarios:

Publicar un comentario