을 게시 웹 API에 적용되지 :구성 변환 내가이 설정을 포함하는 ASP.NET 웹 API 프로젝트를 변환 한
- Web.Live.config을
- Web.UAT.config
게시 할 때 Live
또는 UAT
구성을 선택하면 렌더링 된 web.config
파일에 변환이 적용되지 않습니다.
변환 설정을 확인했으며 name
, xdt:Transform
및 xdt:Locator
이 올바른지 확인했습니다. 내 web.config
에서
내가 가진 내 web.Live.config
에서
<connectionStrings>
<add name="foo" providerName="System.Data.SqlClient" connectionString="[main connection string]" />
</connectionStrings>
내가 가진 :
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="foo"
connectionString="[live connection string]"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
그러나 내 게시 된 연결 문자열은 여전히 Live
을 선택한 경우에도 다음과 같이 표시
<connectionStrings>
<add name="foo" providerName="System.Data.SqlClient" connectionString="[main connection string]" />
</connectionStrings>
가능한 이유는 무엇입니까? 이 일이 일어나기 위해서?
은 어떻게 게시? "프로필 게시"를 사용하고 있습니까? 게시 '연결'유형 (예 : 웹 배포)에 따라 연결 문자열을 설정할 수있는 구체적인 '설정'이 표시됩니다. 확실하지는 않지만 아마도 이것이 기본 연결 문자열로 설정되어 있고 구성 변환보다 우선 순위가 높은지 궁금합니다. 최소한 보일만한 가치가 있습니다 ("런타임에이 연결 문자열 사용"선택을 취소하십시오). 그 외, 설정 파일 자체는 괜찮아 보입니다 – musefan
@musefan 감사합니다.'appSettings'에서'xdt : Transform = "Replace"를 시도해 보았고이 변경 사항이 렌더링 된 설정에 적용되었습니다! 따라서 연결 문자열 부분에 문제가 있습니다. 그러나 VS2012에서 "미리보기 변환"을 수행하면 변환이 적용됩니다. – Curt
허, 변환 미리보기를 할 수 있는지 몰랐습니다. 어쨌든, 어떻게 출판하고 있습니까? 미리보기가 작동하면 변환 후에 다른 것을 덮어 써야합니다. – musefan