いくつかのアンマネージ DLL を内部的に参照するマネージ DLL があります。このマネージ DLL は、WCF サービス プロジェクトへの参照として追加されます。ただし、アンマネージ DLL はプロジェクトのビルド出力パスに手動でコピーする必要があります。Visual Studio 内で参照することはできません。
Visual Studio の WCF サービス ホスト内でサービス DLL を実行しようとすると、後者は例外なくクラッシュし、自動的に再起動します。IIS でサービス DLL をホストしようとすると、Sampe が適用されます。IIS でホストしようとすると、WERReportMetadata クラッシュ ログの 1 つをキャッチでき、ProblemSignatures は次のように述べています。
<ProblemSignatures>
<EventType>CLR20r3</EventType>
<Parameter0>webdev.webserver40.exe</Parameter0>
<Parameter1>10.0.0.0</Parameter1>
<Parameter2>4d5f345a</Parameter2>
<Parameter3>GTAPIASM</Parameter3>
<Parameter4>2.0.5.0</Parameter4>
<Parameter5>4e9254a5</Parameter5>
<Parameter6>166</Parameter6>
<Parameter7>23</Parameter7>
<Parameter8>System.AccessViolationException</Parameter8>
</ProblemSignatures>
これはどういう意味で、どうすればよいですか? アンマネージ DLL を使用した WCF ホスティングに関する参考資料も役立ちます。
編集 1: アンマネージ DLL を %systemroot%\syswow64 にコピーすると、Visual Studio WCF Service Host を使用してサービスをホストできます。ここからヒントを得ました。ただし、これによって WebDev.WebDServer40.exe のクラッシュが停止するわけではありません。
編集 2 これは、イベント ビューアーからキャプチャされた .NET ランタイム エラーです。
アプリケーション: WebDev.WebServer40.exe フレームワーク バージョン: v4.0.30319 説明: 未処理の例外が発生したため、プロセスが終了しました。例外情報: System.TypeInitializationException スタック: System.RuntimeMethodHandle._InvokeConstructor (System.IRuntimeMethodInfo、System.Object []、System.SignatureStruct ByRef、System.RuntimeType) で System.RuntimeMethodHandle.InvokeConstructor (System.IRuntimeMethodInfo、System.Object [] 、System.SignatureStruct、System.RuntimeType) で System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags、System.Reflection.Binder、System.Object[]、System.Globalization.CultureInfo) で System.ServiceModel.Description.ServiceDescription .CreateImplementation(System.Type) で System.ServiceModel.Description.ServiceDescription.SetupSingleton(System.ServiceModel.Description.
編集2:
Visual Studio を常に管理者として実行する必要があることがわかりました。これにより、以前のエラーが解消されます。
ありがとう。