SQL Serverから取得した動的リストをWCFにキャッシュしようとしていますが、取得プロセスはこれまでのところ正常に機能しています。テストしましたが、まったく問題はありません。問題は、これをキャッシュしようとしたときです。取得したリストで、その背後にある理由を見つけることができないというエラーが発生します。
これが私の方法です:
public List<ErrorEntities> GetALL()
{
List<ErrorEntities> res = null;
if (HttpContext.Current.Cache["GetALL"] == null)
{
SqlCommand com = Global.GetCommand("select * from [BlockingList]");
com.Connection.Open();
SqlDataReader reader = com.ExecuteReader();
res = Fill(reader);
HttpContext.Current.Cache.Add("GetALL", res, null, DateTime.Now.Add(new TimeSpan(0, 0, 15)), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
com.Connection.Close();
return res;
}
else
{
res = HttpRuntime.Cache["GetALL"] as List<ErrorEntities>;
return res;
}
}
次のコード行を追加してweb.configファイルのキャッシュを有効にしようとしましたが、問題も解決しませんでした。
<scriptResourceHandler enableCompression="true" enableCaching="true" />
ソリューションをコンパイルしたときに発生するエラーは次のとおりです。
内部エラーのため、サーバーはリクエストを処理できませんでした。エラーの詳細については、サーバーでIncludeExceptionDetailInFaults(ServiceBehaviorAttributeまたは構成動作のいずれかから)をオンにして例外情報をクライアントに送り返すか、Microsoft .NET Framework3.0SDKのドキュメントに従ってトレースをオンにします。サーバーのトレースログを調べます。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more
エラーとそれがコードのどこで発生したかに関する情報。
Exception Details: System.ServiceModel.FaultException: The server was unable to process the request due to an internal error. For more
エラーに関する情報は、サーバーでIncludeExceptionDetailInFaults(ServiceBehaviorAttributeまたは構成動作のいずれかから)をオンにして例外情報をクライアントに送り返すか、Microsoft .NET Framework3.0SDKのドキュメントに従ってトレースをオンにして検査します。サーバートレースログ。
Source Error: Line 113: Line 114: public ServiceReference1.ErrorEntities[] GetALL() { Line 115: return base.Channel.GetALL(); Line 116: } Line 117: