2013-01-10 17 views
3

在我Web.Debug.config我有這樣的:我怎樣才能改變我的web.config給通過<customErrors模式=「關」 />開機時自動調試

<system.web> 
    <!-- 
     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> 

我怎樣才能改變這種做法,它改變了配置文件中的值:在web.config文件

<customErrors mode="Off" /> to <system.web>

回答

5

只要將它改成這樣:

<customErrors mode="Off" xdt:Transform="Replace"> 
    </customErrors> 
4

Eonasdan走上正軌。

正確的方法是在您的調試配置中將錯誤設置爲「關」。

在你Web.Release.config,使用轉換:

<customErrors mode="Off" xdt:Transform="Replace"> 
</customErrors> 

這樣,當你把你的代碼到生產,使用Visual Studio的下拉列表中Web.Release.config文件和轉換將取代web.config文件中的內容。