Visual Studio 2013/2015/2017 profiler在web.config中添加了不可发布的行?

bat*_*aci 10 profiler web-config visual-studio-2013 visual-studio-2015 visual-studio-2017

今天我只是在Instrumentation模式下使用visual studio的分析器来分析我的WCF应用程序.后来我需要发布到我的网络服务器,突然间我收到一条错误,说无法找到Microsoft.VisualStudio.Enterprise.AspNetHelper文件路径.

当我查看我的web.config时,我看到通过分析会话添加了以下行.

  <system.web>
<compilation targetFramework="4.0" debug="true" assemblyPostProcessorType="Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter, 
Microsoft.VisualStudio.Enterprise.AspNetHelper, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>


      <runtime>
<generatePublisherEvidence enabled="false"/>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Microsoft.VisualStudio.Enterprise.AspNetHelper" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
            <codeBase version="12.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2012.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.AspNetHelper.DLL"/>
            </dependentAssembly></assemblyBinding></runtime>

<appSettings>
<!--<add key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation" value="C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools\vsinstr.exe"/>-->
</appSettings></configuration>
Run Code Online (Sandbox Code Playgroud)

很明显它在服务器上寻找一些DLL,但由于这条路径在服务器上无效,因为没有安装VS,它会引发异常.为什么会发生这种情况以及如何避免在web.config中添加这些行?每次进行分析会话时删除这些行都会非常麻烦.

更新:此问题也发生在VS2015上.如果启动VS分析工具,它会在web.config中添加一行

>   <add
> key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation"
> value="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team
> Tools\Performance Tools\vsinstr.exe"/>    <dependentAssembly>
>               <assemblyIdentity name="Microsoft.VisualStudio.Enterprise.AspNetHelper" 
> culture="neutral"/>
>               <codeBase version="14.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2014.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.AspNetHelper.DLL"/></dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

如果您发布到服务器,您将在下面收到此错误

Configuration error
Run Code Online (Sandbox Code Playgroud)

说明:处理此请求所需的配置文件时发生错误.检查下面的特定错误详细信息并相应地修改配置文件.

分析器错误消息:文件或程序集'Microsoft.VisualStudio.Enterprise.AspNetHelper,Version = 14.0.0.0,Culture = neutral,PublicKeyToken ="或其中一个依赖项未找到.系统找不到指定的文件.

来源错误:

服务器上发生应用程序错误.由于此应用程序的当前自定义错误设置,可以显示远程(出于安全原因)应用程序错误的详细信息.但是,可以通过本地服务器上运行的浏览器查看它们.

源文件:C:\ www\web.config行:52

加载跟踪程序集:可以通过以下信息确定,无法加载程序集Microsoft.VisualStudio.Enterprise.AspNetHelper,Version = 14.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a.

警告:装配绑定日志记录为OFF.您可以启用日志程序集绑定失败,删除注册表值[HKLM\Software\Microsoft\Fusion!EnableLog](DWORD)为1集.注意:程序集绑定日志记录错误会导致性能下降.您可以关闭此功能,删除注册表值[HKLM\Software\Microsoft\Fusion!EnableLog.

Kur*_*ula 5

就我而言,这是Visual Studio Profiler的问题。它检查web.config中的本地exe路径。我在web.config中注释了以下两行,它解决了我的问题。

<!--<compilation debug="true" targetFramework="4.5" assemblyPostProcessorType="Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter, Microsoft.VisualStudio.Enterprise.AspNetHelper, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>-->
<!--<add key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation" value="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\vsinstr.exe"/>-->
Run Code Online (Sandbox Code Playgroud)