0

私はc#2アプリケーションで開発しました。1つのASP.NETWebサービスとWebサービスを使用するWinFormsクライアント。クライアントは多くの顧客に配布されています。これらの顧客の1人について、アプリケーションが突然次の例外をスローし始めました。

External component has thrown an exception.
at System.Diagnostics.SharedPerformanceCounter.GetCounter(String counterName, String instanceName, Boolean enableReuse, PerformanceCounterInstanceLifetime lifetime)
at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName, PerformanceCounterInstanceLifetime lifetime)
at System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter.set_RawValue(Int64 value)
at System.Net.NetworkingPerfCounters.Initialize()
at System.Net.Configuration.SettingsSectionInternal..ctor(SettingsSection section)
at System.Net.Configuration.SettingsSectionInternal.get_Section()
at System.Net.ServicePointManager.set_Expect100Continue(Boolean value)
at #Neh.#hgh.#P0f(String[] args)

例外の最後にある難読化された(SmartAssembly 5を使用した)関数は、次のようなクライアントの主な関数です。

public static void Main(string[] args) {
    try {
        AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
        Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

        System.Net.ServicePointManager.Expect100Continue = false;
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        Globals.Settings.NoWaitPrintJobs = true;
        Application.Run(new frmMain());
    }
    catch(Exception ex) {
        HandleUnhandledException(ex);
    }
}

例外から私はそれがラインで壊れていることを理解しています

System.Net.ServicePointManager.Expect100Continue = false;

アプリケーションは相互運用コンポーネントを参照せず、他のマネージDLLのみを参照します。また、shell32.dllのネイティブ関数を使用しています

[DllImport("shell32.dll")]
static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder, bool fCreate);

これは、静的オブジェクトからのメインフォームのロードイベントで呼び出されます。

Globals.Settings.InitLocalFiles();

お客様のパソコンの仕様はまだわかりません。彼はWindowsXPを持っていると思います。何か考えてください?

4

1 に答える 1

1

クライアントを実行しているユーザー アカウントに、パフォーマンス カウンターを使用するための適切なアクセス許可がないようです

「UnauthorizedAccessException」 - 「グローバル\.net clr ネットワーク」を参照してください。

これにより、ネットワーク クラスはパフォーマンス カウンターを使用しなくなります。

于 2012-05-09T14:08:16.657 に答える