asp.net - 如何编译x64 asp.net网站?

标签 asp.net visual-studio iis 64-bit chilkat

我正在尝试使用 Chilkat 库 编译(使用 Visual Studio)一个 ASP.Net 网站。由于此错误,编译失败:

Could not load file or assembly 'ChilkatDotNet2, Version=9.0.8.0, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd' or one of its dependencies. An attempt was made to load a program with an incorrect format.

我被告知,此错误是由于平台不合规而发生的。

奇怪的是,虽然编译失败,但从浏览器访问该网站后就可以工作了。我的理论是,IIS 编译使用 Framework64(64 位)文件夹中的 csc.exe 编译器,而 Visual Studio 使用 Framework(32 位)中的 csc.exe 编译器文件夹。如果确实如此,如何配置我的 Visual Studio 以使用 ASP.Net 站点的 64 位编译器运行?

这是我当前的开发配置:

  • Windows 7 (x64)。
  • Visual Studio 2008 Pro(当然是 x86...)。
  • Chilkat 库 (x64)
  • IIS/Asp.net (x64)。

最佳答案

原因:
您的网站(托管部分,可能全部都是非第三方)不是以 32 或 64 位模式编译的,至少不是以您想象的方式编译的。不同之处在于 Visual Studio 用于其 Web 服务器的 WebDevServer.exe ( Cassini 的版本)完全是 32 位的。因此,它仅加载 32 位兼容的 DLL。

64 位计算机上的 IIS 可以在 32 位或 64 位模式下运行(默认为 64 位),具体取决于配置设置,因此加载应用程序不会遇到任何问题。

解决方案: 不幸的是,这里没有太多选择,I asked the same question a while ago 。最好的选择是使用 IIS 进行调试。你可以这样设置:

  • 网络项目 > 设置
  • “网络”标签
  • 在“服务器”下,选择使用本地 IIS Web 服务器

关于asp.net - 如何编译x64 asp.net网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2596692/

相关文章:

c# - 将信息附加到文本文件

ASP.NET session 状态和多个工作进程

asp.net - Visual Studio 2013 中的 Web 配置选项

c# - 单个 ASP.net 请求的多个核心

asp.net - IIS URL 重写 : Add trailing slash except for . html 和 .aspx

c# - ASP.NET Core : hosting. 未加载 json url

ios - 为什么身份验证不适用于我的 ASP.NET REST API?

WPF 控件就像收藏夹栏

visual-studio - Visual Studio 2019 在哪里可以找到 .net core 3.1 的 WebAssembly 模板

angular - 浏览器在使用 azure 应用服务托管的根 index.html 上保留令人困惑的 Angular 应用的缓存版本