为什么出站URL重写规则需要XmlSerializers.dll

时间:2014-11-07 11:54:37

标签: asp.net url-rewriting xmlserializer sgen

我正在尝试在web.config的重写部分启用OutboundRules,以将所有.html扩展名转换为无扩展名。

但是,当我添加任何规则(它包含的内容无关紧要)时,我收到500错误,指出无法找到.XmlSerializers.dll(请注意,这是错误的数据项目,而不是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,但是,它总是在运行中生成。在这种情况下,它会无声地无法动态生成,因此我们会收到该错误。

那么,首先如何让Serializer工作?第二,为什么需要它?

0 个答案:

没有答案
相关问题