私は毎回失敗することなく展開、開始、実行する単一の作業者役割を持つAzure Cloud Serviceを持っていますが、Application Insightsで診断したい断続的な問題が発生しました。私はthis articleからhereまでの指示に従った。なぜアプリケーションの洞察は私のワーカーの役割の開始を妨げるのですか?
ナゲットパッケージをインストールして1行のコードを追加した後、デバッグモードとリリースモードの両方でクラウドサービスをローカルに実行し、AI情報がApplication Insightsリソースに報告されていることを確認できました。だから私はそれをパッケージ化し、私のクラウドサービスに新しい設定をアップロードしました。
しかし、クラウドからの作業者の役割は実際には始まりません。リサイクルの死スパイラルに入ります。「診断と解決の問題」ブレードでは、以下のエラーが発生します。 Threading.AsyncLocal'1 '"で、RoleEntryPointをロードできません。 this articleの後には、エラーがかなりリサイクルを続ける理由を教えてくれるが、何をすべきかについての手掛かりはないので、物事に多くの光を当てていない。
生産 - WebReportDownloader_IN_0:開始する役割を待っているBusyRole ...役割のエントリポイントをロードできませんでした。 System.TypeLoadException:アセンブリ 'mscorlib、Version = 4.0.0.0、Culture = neutral、PublicKeyToken = b77a5c561934e089'から 'System.Threading.AsyncLocal`1'型を読み込めませんでした。 Microsoft.ApplicationInsights.Extensibility.SdkInternalOperationsMonitor.Exit()、Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.Initialize(TelemetryConfiguration構成、TelemetryModulesモジュール、String serializedConfiguration)、Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.get_Active()WebReportDownloader ..行21 ---内部例外スタックトレースの終了--- System.RuntimeTypeHandle.CreateInstance(RuntimeType型、Boolean publicOnly、内部例外スタックトレースの末尾)で、C:\ Users \ User \ Source \ Repos \ Program \ WebReportDownloader \ WebReportDownloader.csのctorブールNOCHECK、System.RuntimeType.CreateInでSystem.RuntimeType.CreateInstanceSlow(ブールpublicOnly、ブールskipCheckThis、ブールfillCache、StackCrawlMark & stackMark)ブール& canBeCached、RuntimeMethodHandleInternal & CTOR、ブール& bNeedSecurityCheck) Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetRoleEntryPoint(System.Activator.CreateInstance(Type type))のSystem.Activator.CreateInstance(Type type、Boolean nonPublic)のstanceDefaultCtor(Boolean publicOnly、Boolean skipCheckThis、Boolean fillCache、StackCrawlMark & stackMark) (RoleType roleTypeEnum)のMicrosoft.WindowsAzure.ServiceRuntime.RoleEnvironment.CreateRoleEntryPoint(RoleType roleTypeEnum)の[EndPointAssembly]の値を返します。[2017-09-14T15:28:21Z]最後の終了時刻:[2017/09/14、15:28:21.944]。最後の終了コード:
通常、私は例外や詳細を検索するのに十分なヒントを得ることができますが、今回は私の問題に似たものを見つけることができません。私が推測できるのは、小さなものだがクリティカルなものが私の設定では間違っているということだ。しかし、私が上にリンクした指示に基づいて、どこから離れてしまったのか判断できなかった。
マイServiceConfiguration.Cloudファイル...
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="WebReportDownloader" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2015-04.2.6">
<Role name="WebReportDownloader">
<Instances count="2" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="admin" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="ENCRYPTEDVALUE" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2018-09-01T23:59:59.0000000-04:00" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
<Setting name="APPINSIGHTS_INSTRUMENTATIONKEY" value="KEYVALUE" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="847EEDE0084CF57A5A774CAE9E700713726CC856" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
そして、私のApplicationInsights.config ...
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<TelemetryInitializers>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureWebAppRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
</TelemetryInitializers>
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
<ExcludeComponentCorrelationHttpHeadersOnDomains>
<!--
Requests to the following hostnames will not be modified by adding correlation headers.
This is only applicable if Profiler is installed via either StatusMonitor or Azure Extension.
Add entries here to exclude additional hostnames.
NOTE: this configuration will be lost upon NuGet upgrade.
-->
<Add>core.windows.net</Add>
<Add>core.chinacloudapi.cn</Add>
<Add>core.cloudapi.de</Add>
<Add>core.usgovcloudapi.net</Add>
<Add>localhost</Add>
<Add>127.0.0.1</Add>
</ExcludeComponentCorrelationHttpHeadersOnDomains>
</Add>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
<!--
Use the following syntax here to collect additional performance counters:
<Counters>
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
...
</Counters>
PerformanceCounter must be either \CategoryName(InstanceName)\CounterName or \CategoryName\CounterName
NOTE: performance counters configuration will be lost upon NuGet upgrade.
The following placeholders are supported as InstanceName:
??APP_WIN32_PROC?? - instance name of the application process for Win32 counters.
??APP_W3SVC_PROC?? - instance name of the application IIS worker process for IIS/ASP.NET counters.
??APP_CLR_PROC?? - instance name of the application CLR process for .NET counters.
-->
</Add>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer">
<!--</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.FirstChanceExceptionStatisticsTelemetryModule, Microsoft.AI.WindowsServer">-->
</Add>
</TelemetryModules>
<TelemetryProcessors>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/>
<Add Type="Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor, Microsoft.ApplicationInsights"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<ExcludedTypes>Event</ExcludedTypes>
</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<IncludedTypes>Event</IncludedTypes>
</Add>
</TelemetryProcessors>
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
<!--
Learn more about Application Insights configuration with ApplicationInsights.config here:
http://go.microsoft.com/fwlink/?LinkID=513840
Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
--></ApplicationInsights>
そして、私は実際にInstrumentationKeyを設定する私の "のOnStart()" メソッド.. 。
public override bool OnStart()
{
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
TelemetryConfiguration.Active.InstrumentationKey = RoleEnvironment.GetConfigurationSettingValue("APPINSIGHTS_INSTRUMENTATIONKEY");
// For information on handling configuration changes
// see the MSDN topic at https://go.microsoft.com/fwlink/?LinkId=166357.
bool result = base.OnStart();
Trace.TraceInformation("WebReportDownloader has been started");
return result;
}
私は...
更新誰でも提供することができます任意の洞察力(HA!)や指導をいただければ幸いです。さらに実験を通して
、私は私がしようとしている時はいつでもすることを決定しましたApplication Insightアセンブリを直接呼び出す(テレメトリクライアントを作成する場合やApplicationInsightsリソースキーを直接設定する場合など)、トレースのためにApplicationInsight TraceListenerが呼び出された場合は、以下の例外があります。
アセンブリ 'mscorlib、Version = 4.0.0.0、Culture = neutral、PublicKeyToken = b77a5c561934e089'から 'System.Threading.AsyncLocal`1'型を読み込めませんでした。
私は実行時の計測を行うと、基本的なトレースとログをInsightのリソースに追加できますが、何かを取得しようとするとさらに逃げ出します。
さらに、私は現在、.NET 4.6.1(以前は言及しなかった情報)をターゲットにしています。
少なくとも、問題を作り出しているプロジェクトが深いという恐れがあることを確認してくれてありがとう。私は常にコピーするように設定されたApplicationInsights.configを持っています。そして、実行時計装を使用する前の試みは私に同じ問題を与えました。今日私は別のパスを取って、もう情報が見つかると更新します。 – jdmac020