Dot-Net

Web.config 中的奇怪警告

  • June 26, 2019

一張圖片值1000字,所以這裡有幾張圖片(忽略我的編輯):

警告 1

警告 2

警告 3

在此解決方案的任何項目中,我既沒有引用也沒有使用實體框架。在我安裝了一堆 Windows 更新之後,這才從周二開始發生。總共有九個警告。我正在執行 Windows 8.1 Pro,但我不知道這是否重要。我在同一個解決方案中有其他項目具有相同的項目類型和 .NET 框架版本。該項目本身似乎在 IIS 中執行良好。我所有的 Web.config 文件都具有相似的配置和結構。這是有問題的(更多編輯):

<?xml version="1.0"?>
<configuration>
   <configSections>
       ...
   </configSections>
   ...
   <connectionStrings>
       ...
   </connectionStrings>
   <system.web>
       <compilation debug="true" targetFramework="4.5.1"/>
       <authentication mode="None"/>
       <sessionState mode="Off"/>
       <customErrors mode="RemoteOnly"/>
       <httpRuntime enableHeaderChecking="false" enableVersionHeader="false" requestValidationMode="2.0" sendCacheControlHeader="false" targetFramework="4.5.1"/>
   </system.web>
   <system.webServer>
       <httpErrors existingResponse="PassThrough"/>
       <validation validateIntegratedModeConfiguration="true"/>
       <handlers>
           <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
           <remove name="OPTIONSVerbHandler"/>
           <remove name="TRACEVerbHandler"/>
           <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
       </handlers>
       <staticContent>
           <clientCache cacheControlMode="UseMaxAge" httpExpires="7.00:00:00"/>
       </staticContent>
       <urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true"/>
       <defaultDocument>
           <files>
               <clear/>
           </files>
       </defaultDocument>
   </system.webServer>
   <system.runtime.caching>
       <memoryCache>
           <namedCaches>
               ...
           </namedCaches>
       </memoryCache>
   </system.runtime.caching>
   <runtime>
       <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
           <dependentAssembly>
               <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
               <bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0"/>
           </dependentAssembly>
           <dependentAssembly>
               <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
               <bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0"/>
           </dependentAssembly>
           <dependentAssembly>
               <assemblyIdentity name="Microsoft.ServiceBus" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
               <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0"/>
           </dependentAssembly>
           <dependentAssembly>
               <assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
               <bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0"/>
           </dependentAssembly>
       </assemblyBinding>
   </runtime>
</configuration>

我仍然不確定如何,但我設法通過刪除 Web.config 及其轉換並重新創建它們來“解決”問題。之後我做了一個差異,沒有看到任何可能導致此類警告的差異。我想我可以把它歸結為某種奇怪的記憶體問題。

我在 Visual Studio 2017 中搜尋類似問題的解決方案時發現了這個老問題。接受的答案讓我走上了正軌。這一定是記憶體問題。再搜尋一下 - 這是一個智能感知記憶體問題。

Rick Strahl 有一篇關於此的非常好的文章

通過從解決方案中刪除 .vs 文件夾解決了我的問題。.vs 文件夾是在 Visual Studio 2015 中引入的。所以這不是對這個問題的直接答案,而是對未來訪問者的提示。

引用自:https://stackoverflow.com/questions/19967467