質問

電子書籍を作成できるアプリケーションがあります。 このアプリケーションには、AIRファイルを作成するエクスポートモジュールがありますが、これには時間がかかる場合があります(一部の本には2500ページあります)。 エクスポートすると、次のエラーが表示されます。

Thread was being aborted. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Threading.ThreadAbortException: Thread was being aborted.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 

[ThreadAbortException: Thread was being aborted.]
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +501
   System.Web.ApplicationStepManager.ResumeSteps(Exception error) +564
   System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +141
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +436

ランタイムの実行タイムアウトを3600秒に変更しましたが、約3分間クラッシュし続けます。 時間に関係しています...クラッシュする3分に近づくたびに、誰かが私を助けてくれることを願っています。

役に立ちましたか?

解決

私は、ポールが例外の原因について正しいと思います。 IISとASP.NETの両方には、要求にかかる最大時間を制限する設定があります。 ASP.NETの場合、Machine.Configファイルにあります(httpRuntime要素、executionTimeout属性を探します)。開発マシンでは90秒に設定されています。

ただし、不適切なリクエストでアプリケーションがハングしないようにするために、設定を変更することはお勧めしません。

長時間実行されるタスクでは、非同期実行を使用する必要があります。非同期実行では、実際の作業は別のスレッドで処理されます。これにより、リクエストを処理するスレッドが解放され、アプリケーションの全体的なパフォーマンスに適した他のリクエストを処理できます。

これに関するいくつかの良い記事があります。例: http://msdn.microsoft.com/en-us/magazine /cc163725.aspx

他のヒント

かなり頻繁に、このエラーは実際にはOutOfMemory例外から発生します。 使用可能なInnerExceptionがありますか?

IISには「run-away」スレッド保護があり、実行時間が長すぎるとスレッド/アプリドメインを強制終了します。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top