1

web.config の書き換えセクションで OutboundRules を有効にして、すべての .html 拡張子を拡張子なしに変換しようとしています。

ただし、ルールを追加すると (内容は関係ありません)、.XmlSerializers.dll が見つからないことを示す 500 エラーが表示されます (エラーが発生しているのは Web プロジェクトではなく、データ プロジェクトであることに注意してください)。outboundRules セクションを削除するとすぐに、サイトが再び機能し始めます。

HTTP Error 500.52 - URL Rewrite Module Error.

System.IO.FileNotFoundException: Could not load file or assembly '<data project>.XmlSerializers' or one of its dependencies. The system cannot find the file specified. File name: '<data project>.XmlSerializers' 
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
at System.Reflection.RuntimeAssembly.LoadWithPartialNameInternal(AssemblyName an, Evidence securityEvidence, StackCrawlMark& stackMark) 
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 

sgen を使用してローカルで XmlSerializer を実際に生成しようとしましたが、次のエラーで失敗します。

 Error: Cannot deserialize type 'System.ComponentModel.DataAnnotations.DataTypeAttribute' because it contains property 'DataType' which has no public setter.

したがって、OutboundRules には常に XmlSerializer が必要であると想定していますが、常にオンザフライで生成されます。この状況では、オンザフライでの生成が暗黙のうちに失敗するため、そのエラーが発生します。

では、まずシリアライザを機能させるにはどうすればよいでしょうか。第二に、なぜそれが必要なのですか?

4

0 に答える 0