2013-10-16 5 views
6

IIS 7.5で.NET 2.0ランタイムを使用して簡単な.netアプリケーションを使用していますが、web.configのマシンキーを変更しました。SHA1に設定されたマシンキーでデータエラーを検証できません

<machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="SHA1"/> 

これはローカルで正常に動作しますが、サーバーに公開すると、サイトを参照するたびに「HttpException(0x80004005):データを検証できません」というメッセージが表示されます。私はコンパイルを設定することを確認したデバッグ= "偽"。検証方法を3DESに設定するとこの問題は解決されますが、SHA1で作業する必要があります。私はここで欠けているいくつかの設定オプションはありますか?以下のスタックトレースを参照してください。

 
[HttpException (0x80004005): Unable to validate data.] 
    System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo, Boolean signData) +1008 
    System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo) +91 
    System.Web.UI.Page.EncryptStringWithIV(String s, IVType ivType) +83 
    System.Web.UI.Page.EncryptString(String s) +30 
    System.Web.Handlers.RuntimeScriptResourceHandler.GetScriptResourceUrlImpl(List`1 assemblyResourceLists, Boolean zip, Boolean notifyScriptLoaded) +1497 
    System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(List`1 assemblyResourceLists, Boolean zip, Boolean notifyScriptLoaded) +1148 
    System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +152 
    System.Web.Handlers.ScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +37 
    System.Web.UI.ScriptManager.GetScriptResourceUrl(String resourceName, Assembly assembly) +105 
    System.Web.UI.ScriptRegistrationManager.RegisterClientScriptResource(Control control, Type type, String resourceName) +113 
    System.Web.UI.ScriptManager.System.Web.UI.IScriptManager.RegisterClientScriptResource(Control control, Type type, String resourceName) +14 
    System.Web.UI.ClientScriptManager.RegisterClientScriptResource(Control control, Type type, String resourceName) +53 
    System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript) +113 
    System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e) +25 
    System.Web.UI.Control.PreRenderRecursiveInternal() +80 
    System.Web.UI.Control.PreRenderRecursiveInternal() +171 
    System.Web.UI.Control.PreRenderRecursiveInternal() +171 
    System.Web.UI.Control.PreRenderRecursiveInternal() +171 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842 

答えて

2

"System crytography:暗号化、ハッシュ、および署名にFIPS準拠のアルゴリズムを使用する"(Security Settings >> local policies >> securityOptions)のローカルセキュリティポリシーがtrueに設定されている場合、Sha1は機能しません。私はこの場合にエラーが発生している理由です。

+0

ここで私はこのオプションを見ることができますか? >> securityOptions – codetoshare

+0

これは古いですが、メモを書き込むと思っています...この設定は、ローカルコンピュータポリシー>コンピュータの構成> Windowsの設定>セキュリティの設定>ローカルのグループポリシーエディタ(gpedit.msc)にあります。 [Policies]> [Security Options]の順に選択します。変更後はiisresetする必要があります。 –

4

本当に.NET 2.0アプリケーションプールでアプリケーションを実行していますか? (私はあなたがIIS 7.5を使用しているので尋ねています)。

そうでない場合は、.NET 4.5フレームワークの暗号化アルゴリズムが変更されていることに注意してください。

あなたは互換性のタグが必要になります< .NET 4.5 Frameworkの互換性が必要な場合:

<machineKey compatibilityMode="Framework20SP1" /> 

詳細についてはhttp://msdn.microsoft.com/en-us/library/system.web.configuration.machinekeysection.compatibilitymode.aspxまたはhttp://blogs.msdn.com/b/webdev/archive/2012/10/23/cryptographic-improvements-in-asp-net-4-5-pt-2.aspxを参照してください。

+0

はい私のサイトのアプリケーションプールは.NET 2.0を使用するように設定されています – Ben

+0

互換性タグを試すことはできますが、動作しない場合はここで空白です。それについて申し訳ありません...:| – Stefan

+0

私はcompatibilityModeタグをmachinekeyセクションに入れてみましたが、同じエラーが表示されています:( – Ben

関連する問題