2012-06-06 60 views
0

我試圖使用web.config變壓器,但它什麼也沒做。 這裏是我的web.config的最後一部分:web.config變壓器什麼都不做

<system.serviceModel> 
<bindings> 
    <basicHttpBinding> 
    <binding name="BasicHttpBinding_IUserInterfaceService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> 
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 

     <security mode="None"> 
     <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> 
     <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    </basicHttpBinding> 

</bindings> 
<client> 
    <endpoint address="http://[WhiteOPS User Interface]:[Port]/UIService/UserInterfaceService/" 
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserInterfaceService" 
    contract="UserInterface.IUserInterfaceService" name="BasicHttpBinding_IUserInterfaceService" /> 
</client> 

這裏是我web.debug.config:

<?xml version="1.0"?> 
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
    <endpoint name="BasicHttpBinding_IUserInterfaceService" address="http://localhost:80/UIService/UserInterfaceService/" 
    xdt:Transform="SetAttributes" xdt:Locator="Match(name)" /> 

時我運行(有或沒有調試國防部e)在調試配置中,我收到一條錯誤,表示此行無法編譯:

<endpoint address="http://[WhiteOPS User Interface]:[Port]/UIService/UserInterfaceService/" 
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserInterfaceService" 
contract="UserInterface.IUserInterfaceService" name="BasicHttpBinding_IUserInterfaceService" /> 

那麼爲什麼轉換不會發生?

感謝,

回答

1

你需要建立它在相同的結構,你的其他的web.config。

所以你需要用相同的<client>標籤來包裝它,這樣變壓器才能在相同的位置找到它。

<?xml version="1.0"?> 
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
    <client> 
     <endpoint name="BasicHttpBinding_IUserInterfaceService" address="http://localhost:80/UIService/UserInterfaceService/" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" /> 
    </client> 

希望這有助於!

+0

感謝您的評論,我已經做到了(實際上我從系統模型節點構建了整棵樹),我也嘗試使用「替換」而不是「setAttributes」,它仍然不能工作。 .... – Shahar