私はこれまでに失敗するとは思っていない非常に奇妙な問題があります。 AspDotNetStoreFrontに基づいて、それほど巨大ではないトラフィックがあるウェブサイトです。リーダーからデータベースフィールドを読み取ろうとすると、サイトが断続的にクラッシュします。これはウェブサイトのさまざまな場所で発生します。このようなコードの例は、の行にあります。オブジェクトpValue = rs ["PropertyValueString"];IDataReaderからフィールドを読み取っている間に断続的なSystem.IndexOutOfRangeExceptionが発生する
private Dictionary<string, object> GetPropertValuePairs(string userName)
{
string query = string.Format("select PropertyName, PropertyValueString from dbo.profile with(nolock) where CustomerGUID = {0} and StoreID = {1}", DB.SQuote(userName),AppLogic.StoreID());
Dictionary<string, object> propertyValues = new Dictionary<string, object>();
using (SqlConnection conn = new SqlConnection(DB.GetDBConn()))
{
conn.Open();
using (IDataReader rs = DB.GetRS(query, conn))
{
while (rs.Read())
{
string pName = DB.RSField(rs, "PropertyName");
object pValue = rs["PropertyValueString"];
if (propertyValues.ContainsKey(pName) == false)
{
propertyValues.Add(pName, pValue);
}
}
rs.Close();
rs.Dispose();
}
conn.Close();
conn.Dispose();
}
return propertyValues;
}
それはSqlClientでの標準的な使用であり、私はそれに何かを見ることはできません。 System.DataでSystem.Data.SqlClient.SqlDataReader.GetOrdinalでSystem.Data.ProviderBase.FieldNameLookup.GetOrdinal(文字列フィールド名) (文字列名) で
System.IndexOutOfRangeException:エラーのスタックトレースはこれです。システムでSystem.Configuration.SettingsBase.GetPropertiesFromProviderでAspDotNetStorefront.ASPDNSFProfileProvider.GetPropertyValues(SettingsContext文脈、SettingsPropertyCollection settingsProperties)でAspDotNetStorefront.ASPDNSFProfileProvider.GetPropertValuePairs(文字列のuserName) でSqlClient.SqlDataReader.get_Item(文字列名) (SettingsProviderプロバイダ) .Configuration.SettingsBase.GetPropertyValueByName(String propertyName) System.Web.ProfileでSystem.Web.Profile.ProfileBase.GetInternalでSystem.Configuration.SettingsBase.get_Item(文字列プロパティ名) System.Web.Profile.ProfileBase.get_Itemで(文字列プロパティ名) (文字列プロパティ名) ました。 ProfileBase.GetPropertyValue System.Web.UI.Page.ProcessRequestMain(ブールincludeStagesBeforeAsyncPoint、ブールのincludeStagesAfterAsyncPoint)でSystem.Web.UI.Page.PerformPreInitでAspDotNetStorefront.SkinBase.OnPreInitで(文字列propertyNameの) (EventArgsの電子) ()
サイトがクラッシュした場合、IISを再起動して再度オンにする必要があります。これは、Windows Server 2008上で.NET 3.5およびSQL 2008がすべて最新のものです。マシンは64ビットで、SQL Serverには32ビットモードが有効になっているほか、「クラシックパイプラインモード」を使用するアプリケーションプールもあります。接続文字列は
<add name="PrimaryConnectionString" connectionString="data source=XXXX;database=XXXX;Integrated Security=True;Application Name=XXXX;MultipleActiveResultSets=true" />
非常に非常に感謝!
こちらも同じです。 32ビットモードのASP.NET2.0 SP2を実行している64ビットマシンとの互換性問題があります。解決策が見つかると更新されます。 –
同じ問題が発生していますが、解決策を見つけましたか? @ジョニーgは、ビットの不一致問題でしたか? David、これはマルチスレッドアプリですか? –
マーク私は、以下の答えがあると思います。これは私たちにとって過去の問題でした。私のソリューションが役立つかどうか、あなたの考えを教えてください。 – CaptainBli