简体   繁体   English

Web.config中的奇怪警告

[英]Strange warnings in Web.config

A picture is worth 1000 words, so here are several pictures (ignore my redacting): 一张图片值1000字,所以这里有几张图片(忽略我的编辑):

警告1

警告2

警告3

I am neither referencing nor using Entity Framework in any project in this solution. 我在此解决方案中的任何项目中都没有引用或使用Entity Framework。 This just started happening as of Tuesday after I installed a bunch of Windows updates. 在我安装了一堆Windows更新后,这种情况刚刚开始发生。 There are nine warnings in total. 共有九个警告。 I'm running Windows 8.1 Pro, but I don't know if that matters. 我正在运行Windows 8.1 Pro,但我不知道这是否重要。 I have other projects in the same solution with identical project types and .NET framework versions. 我在同一解决方案中有其他项目,具有相同的项目类型和.NET框架版本。 The project itself appears to run just fine in IIS. 该项目本身似乎在IIS中运行良好。 All of my Web.config files have similar configuration and structure. 我的所有Web.config文件都具有类似的配置和结构。 This is the problematic one (more redacting): 这是有问题的(更多编辑):

<?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>

I am still not sure how, but I managed to "fix" the problem by deleting Web.config and its transforms and recreating them. 我仍然不确定如何,但我设法通过删除Web.config及其转换并重新创建它来“修复”该问题。 I did a diff afterward and didn't see any differences that might cause such warnings. 之后我做了一个差异,并没有看到任何可能导致此类警告的差异。 I guess I can chalk it up to some kind of strange caching issue. 我想我可以把它归结为某种奇怪的缓存问题。

I found this old question while searching a solution for a similar problem in Visual Studio 2017. The accepted answer put me on the right track. 在Visual Studio 2017中搜索类似问题的解决方案时,我发现了这个老问题。接受的答案让我走上正轨。 This must be a caching problem. 这必须是缓存问题。 One search more - this is an intellisense caching problem. 一个搜索更多 - 这是一个intellisense缓存问题。

There is a very good article from Rick Strahl about this. Rick Strahl有一篇非常好的文章

My problem was solved by removing the .vs folder from the solution. 通过从解决方案中删除.vs文件夹解决了我的问题。 The .vs folder was introduced with Visual Studio 2015. So this isn't a direct answer to this question, but a hint for future visitors. .vs文件夹是随Visual Studio 2015引入的。所以这不是这个问题的直接答案,而是对未来访问者的一个提示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM