Проблемы с установкой Application Insights на .NET 4.7.2 из Visual Studio - PullRequest
0 голосов
/ 25 августа 2018

Во-первых, я получаю всевозможные странные ошибки, пытаясь использовать Visual Studio 15.9 Preview 1, включая всевозможные всплывающие окна во время установки.Я вернулся к Visual Studio 15.8 RTM, но все равно получил ошибки.

Это то, что я вижу, пытаясь открыть мое приложение ASP.NET.

[BadImageFormatException: Cannot load a reference assembly for execution.]

[BadImageFormatException: Could not load file or assembly 'System.Runtime' or one of its dependencies. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

DLL System.Runtime отображается какследующие

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\
  .NETFramework\v4.7.2\Facades\System.Runtime.dll

1 Ответ

0 голосов
/ 25 августа 2018

Application Insights в Visual Studio устанавливаются с помощью пункта меню, вызываемого правой кнопкой мыши.

Прежде всего, если вы выполняете какую-либо «волшебную» установку, подобную этой, сначала убедитесь, что весь ваш код проверен в системе контроля версий.

Если это не удастся, вы сможете увидеть, что именно он пытался изменить. В моем случае это было следующее. Он добавил эти два:

enter image description here

  <dependentAssembly>
    <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
  </dependentAssembly>

Когда я их прокомментировал, приложение снова заработало.

Обязательно проверьте в Azure, что данные поступают:

enter image description here

Жаль, что я полностью не понял, что случилось, хотя.

Обратите внимание, что после того, как он заработал, актуальная версия System.Runtime, которая загружена, составляет

C: \ Windows \ Microsoft.Net \ сборка \ GAC_MSIL \ System.Runtime \ v4.0_4.0.0.0__b03f5f7f11d50a3a \ System.Runtime.dll

...