I'm trying to enable OutboundRules in the rewrite section of a web.config to convert all .html extensions to extensionless.
However, when I add any rule (it doesn't matter what it contains), I receive a 500 error stating that .XmlSerializers.dll cannot be found (note that it's the data project that is erroring, not the web project). As soon as I remove the outboundRules section, the site starts working again.
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].
I've tried actually generating the XmlSerializer locally using sgen, and it fails with the following error:
Error: Cannot deserialize type 'System.ComponentModel.DataAnnotations.DataTypeAttribute' because it contains property 'DataType' which has no public setter.
So my assumption is that OutboundRules always requires the XmlSerializer, however, it's always generated on the fly. In this situation it fails silently to generate on-the-fly, and therefore we get that error.
So, first how can make the Serializer work? and second, why is it required?