Azure 移动服务和应用程序洞察

Azure Mobile Services and Application Insights

我已将 Azure Application Insights 添加到新的 Azure 移动服务(.NET 后端)项目中。当我 运行 它在我的本地机器上时,它正在向洞察力发送数据。但是当我将它部署到 Azure 时,它​​就不起作用了。在门户的日志中,我收到以下消息。有人知道如何解决这个问题吗?

Message='Could not load assembly 'D:\home\site\wwwroot\bin\Microsoft.ApplicationInsights.Extensions.Intercept_x86.dll'. Error received: 'Could not load file or assembly 'file:///D:\home\site\wwwroot\bin\Microsoft.ApplicationInsights.Extensions.Intercept_x86.dll' or one of its dependencies. The module was expected to contain an assembly manifest.'.', Exception=System.BadImageFormatException: Could not load file or assembly 'file:///D:\home\site\wwwroot\bin\Microsoft.ApplicationInsights.Extensions.Intercept_x86.dll' or one of its dependencies. The module was expected to contain an assembly manifest. File name: 'file:///D:\home\site\wwwroot\bin\Microsoft.ApplicationInsights.Extensions.Intercept_x86.dll' at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) at System.Reflection.Assembly.LoadFrom(String assemblyFile) at Microsoft.WindowsAzure.Mobile.Service.Config.WebHostAssemblyResolver.LoadAssembly(String assemblyFilePath) at Microsoft.WindowsAzure.Mobile.Service.Config.WebHostAssemblyResolver.GetApplicationAssemblies(ICollection1 asmPaths, ISet1 excludedAssemblyNames)

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. , Id=00000000-0000-0000-0000-000000000000, Category='Service.Hosting'

此异常是第一次机会异常,一般不会影响监控。 AI 不起作用,因为 Azure 移动服务基础结构阻止了 http 模块,因此无法加载应用程序洞察 http 模块。现在没有解决方法可以启用自动收集。您只能手动检测您的代码。