为什么程序集绑定重定向在我的网站中不起作用?

Mic*_*out 23 .net asp.net assemblies

我有一个网站项目,我使用内置的开发Web服务器从Visual Studio运行.网站的虚拟路径设置为/

web.config包含一个运行时元素

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="CMS.Controls" publicKeyToken="834b12a258f213f9" culture="neutral" />
      <bindingRedirect oldVersion="4.1.3518.21577" newVersion="4.1.3561.21846" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>
Run Code Online (Sandbox Code Playgroud)

我已经xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"从根configuration元素中删除了该属性.

这是错误:

无法加载文件或程序集'CMS.Controls,Version = 4.1.3518.21577,Culture = neutral,PublicKeyToken = 834b12a258f213f9'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

这是绑定的日志:

The operation failed.
Bind result: hr = 0x80131040. No description available.
...
LOG: DisplayName = CMS.Controls, Version=4.1.3518.21577, Culture=neutral, PublicKeyToken=834b12a258f213f9
 (Fully-specified)
...
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Project\WebSite\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: CMS.Controls, Version=4.1.3518.21577, Culture=neutral, PublicKeyToken=834b12a258f213f9
...
LOG: Assembly Name is: CMS.Controls, Version=4.1.3561.21846, Culture=neutral, PublicKeyToken=834b12a258f213f9
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
Run Code Online (Sandbox Code Playgroud)

在我看来,它忽略了我的重定向.我一直在看它一个小时,我有拼写错误吗?

Tod*_*Tod 0

这是 64 位/32 位 dll 问题吗?有时不同的系统有不同的 dll 版本。即使您运行的是 64 位版本的 Windows,开发 Web 服务器也会作为 32 位应用程序运行。

如果切换到 CassinDev Server,则可以切换到 64 位开发服务器。它的工作原理是一样的。