最近、ウェブサイトを1.1から2.0にアップグレードすることを決定しました。Visual Studio 2010を使用してアップグレードしましたが、アップグレードは正常に機能しました。
このWebサイトはEnterpriseLibrary2005を使用しており、それを機能させるのに非常に時間がかかっています。APIに大きな違いがあるため、EnterpriseLibrary2006をアップグレードしないことをお勧めします。
エンタープライズライブラリを機能させるために最初に行ったのは、これを\ Framework \ v2.0.50727\Machine.Configに追加したことです。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<section name="enterpriselibrary.configurationSettings" type="System.Configuration.IgnoreSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<enterpriselibrary.configurationSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" applicationName="X" xmlns="http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/configuration">
<configurationSections>
<configurationSection xsi:type="ReadOnlyConfigurationSectionData" name="dataConfiguration" encrypt="false">
<storageProvider xsi:type="RegistryStorageProviderData" name="Registry Storage Provider" registryRoot="LocalMachine" registrySubKey="SOFTWARE\X" />
<dataTransformer xsi:type="XmlSerializerTransformerData" name="Xml Serializer Transformer">
<includeTypes />
</dataTransformer>
</configurationSection>
<configurationSection xsi:type="ReadOnlyConfigurationSectionData" name="securityCryptographyConfiguration" encrypt="false">
<storageProvider xsi:type="RegistryStorageProviderData" name="Registry Storage Provider" registryRoot="LocalMachine" registrySubKey="SOFTWARE\X" />
<dataTransformer xsi:type="XmlSerializerTransformerData" name="Xml Serializer Transformer">
<includeTypes />
</dataTransformer>
</configurationSection>
</configurationSections>
<keyAlgorithmStorageProvider xsi:nil="true" />
<includeTypes />
</enterpriselibrary.configurationSettings>
</configuration>
しかし、私がこの関数を呼び出すたびに
Cryptographer.CompareHash( "X", X, X )
このエラーが発生します
System.InvalidCastException was unhandled
Message=Specified cast is not valid.
Source=Microsoft.Practices.EnterpriseLibrary.Configuration
StackTrace:
at Microsoft.Practices.EnterpriseLibrary.Configuration.Storage.ConfigurationChangedRegistryWatcher.Poller()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
この関数を呼び出そうとすると、同じエラーが発生します
DBCommandWrapper l_sqlWrapper = _db.GetStoredProcCommandWrapper("x");
l_sqlWrapper.AddInParameter("@x", DbType.Int32, "X");
これは1.1で正常に機能し、渡したすべての値がnullではなく、正当な値を持っていることを確認したためです。誰かがなぜ手がかりを持っているでしょうか?