當開始一個新的web項目時,我總是有點擔心刪除web.config文件。 Net 3.5 SP1似乎有比以往更多的條目。我可以安全刪除web.config的哪些區域?
中的.config位你刪除這對於以下情況:
- WCF Web服務,不支持JavaScript
- 簡單的MVC網站
編輯 可有人文檔基本一個簡單的網站留在和取出web.config的東西列表?
當開始一個新的web項目時,我總是有點擔心刪除web.config文件。 Net 3.5 SP1似乎有比以往更多的條目。我可以安全刪除web.config的哪些區域?
中的.config位你刪除這對於以下情況:
編輯 可有人文檔基本一個簡單的網站留在和取出web.config的東西列表?
下面是一個剝離下來的Web.config我用一個簡單的WCF服務
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<authentication mode="Windows" />
<customErrors mode="RemoteOnly" defaultRedirect="error.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<system.serviceModel>
<services>
<service behaviorConfiguration="Service.ServiceBehavior" name="Service.Service">
<endpoint address="" binding="basicHttpBinding" contract="Service.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Service.ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
我刪除了很多羣衆演員尤其是腳本模塊,我不會要求
我通常只是從web.config中刪除項目,直到事情中斷 - 一個試驗和錯誤的過程。
令人驚訝的是可以在不影響任何內容的情況下移除多少web.config。它在.NET 3.5中變得相當笨拙。
與Jeff非常同意,這是一個試驗和錯誤的過程,可以從文件中刪除。
在調整運行時和http管道方面,通常可以通過向web.config添加內容的過程來關閉它。
開箱即用的配置爲流水線添加了很多模塊,具體取決於您在做什麼,您可能不需要其中的一半。
所遇到的一些文章對這個MSDN上,也這一個http://www.codeproject.com/KB/aspnet/10ASPNetPerformance.aspx,奧馬爾從飛鴿,這是唯一一個我能找到我的(組織得很差)的書籤,這是優化一個很好的起點運行時間。
特別是在我的WCF主機web應用程序在IIS7中,web.config文件沒有所有的標準cruft。 – cfeduke 2008-11-06 02:20:01