如何在 x64 中使用 WebDev.WebServer.exe (VS Web Server)? [英] How to utilize WebDev.WebServer.exe (VS Web Server) in x64?

查看:26
本文介绍了如何在 x64 中使用 WebDev.WebServer.exe (VS Web Server)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 是 x86,直到 至少在 2010 年发布之前 更新:这在 VS2010 中仍然是一个问题,没有原生 64 位 Cassini 支持.我的问题是有人能想出办法或知道 2008 年或 2010 年的 x64 独立 ASP.NET 调试服务器吗?

背景:我们的 ASP.NET 应用程序针对作为数据库的 Oracle 运行.由于我们稍后在 64 位服务器上处理内存问题,因此我们需要使用 Oracle 的 64 位驱动程序(Instant Client).

设置:

  • x64 操作系统(XP 或 Windows 7)
  • IIS(6 或 7,均为 x64 应用程序池)
  • Oracle 64 位即时客户端(单独的目录,在 PATH 中)
  • Visual Studio 2008 SP1 Visual Studio 2010

在 IIS 中,应用程序池以 64 位运行,按预期使用 Oracle 驱动程序,但是由于 WebDev.WebServer.exe 是 32 位,您将得到 BadImageFormatExceptionstrong> 因为它试图在 32 位环境中加载 64 位驱动程序 DLL.我们所有的开发人员都希望能够通过 Visual Studio 2008 使用快速调试服务器,但由于它以 32 位运行,我们无法做到.我们遇到的一些问题是在应用程序启动期间,因此虽然我们有时会附加到 IIS 进程,但这还不足以追踪问题.

是否有任何替代方案或解决方法?我们希望尽可能匹配我们的 Dev/Val/Prod 层,因此所有在 x64 中运行的东西都是理想的.

<小时>

VS 2010 更新

自从第一次发布以来对这个问题进行了很多更改,第一个 VS2010 现在已经发布,这里仍然存在相同的问题,但是我所在的项目没有.我们进行了 2 次更改以解决此问题,因此我将发布这些更改,希望能减轻其他人的痛苦:

第一个解决方案是在 32 位模式下加载 Oracle x86,在 64 位模式下加载 x64,我们通过 web.config 在 64 位下运行时替换程序集引用来做到这一点,如下所示:

<预><代码><配置><运行时><程序集绑定><从属程序集><assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" processorArchitecture="amd64"/><bindingRedirect oldVersion="2.0.0.0-10.9.9.9" newVersion="2.102.3.2"/></dependentAssembly></assemblyBinding></运行时></配置>

这里的关键是 processorArchitecture="amd64",这意味着替换仅在 64 位下运行时发生.

请注意,这些版本现在可能已经过时了(如果您正在阅读这篇特别关心 Oracle 的内容),那是很久以前的事了.除了配置之外,我们还加载了 32 位和 64 位版本的 Oracle.DataAccess 进入 GAC.Oracle 10g 的 32 位版本是 10.xxx,64 位版本是 2.1xxx,所以只需 使用<assemblyBinding> 工作交换绑定.

第二个更长期的解决方案是完全脱离 Oracle 客户端,我们现在使用 dotConnect for Oracle 用于我们的 Linq-to-SQL 提供程序,并且由于它是使用直接 TCP 连接的完全托管代码,我们在应用程序中没有更多的 32/64 位特定代码,这是很多 更易于维护.

我希望发现这个的人也会发现后续内容也很有用.如果您对我最终使用的任一解决方案有疑问,请发表评论,我会尝试更详细地解释.

解决方案

两个想法:

  1. 使用来自 Mono 项目的 XSP 拼凑一些东西.
  2. 在完全 32 位环境中测试,部署到 64 位环境中.

Visual Studio is x86 until at least the 2010 release comes around update: this is still an issue in VS2010, there is no native 64bit Cassini support. My question is can anyone think of a way or know of an independent ASP.NET debug server that's x64 for 2008 or 2010?

Background: Our ASP.NET application runs against Oracle as the DB. Since we're on 64-bit servers for memory concerns later, we need to use Oracle's 64-bit drivers (Instant Client).

Setup:

  • x64 OS (XP or Windows 7)
  • IIS (6 or 7, both x64 App Pools)
  • Oracle 64-bit Instant Client (Separate Directory, in the PATH)
  • Visual Studio 2008 SP1 Visual Studio 2010

In IIS the application pool runs as 64-bit, uses the Oracle drivers as intended, however since WebDev.WebServer.exe is 32-bit you'll get a BadImageFormatException because it's trying to load 64-bit driver DLLs in a 32-bit environment. All of our developers would like to be able to use the quick debug server via Visual Studio 2008, but since it runs as 32-bit we're unable to. Some problems we run into are during application startup, so although we're attaching to the IIS process sometimes that isn't enough to track an issue down.

Are there any alternatives, or work-arounds? We would like to match our Dev/Val/Prod tiers as much as possible, so everything running in x64 would be ideal.


Update for VS 2010

A lot of changes to this question since it was first posted, first VS2010 is out now, it still has the same issues here, however the project I'm on does not. We went through 2 changes to solve this, so I'll post these in hope it saves someone else grief:

The first solution was to load Oracle x86 in 32-bit more, x64 in 64-bit mode, we did this by replacing the assembly reference when running under 64-bit via the web.config, like this:

<configuration>
  <runtime>
    <assemblyBinding>
      <dependentAssembly>
        <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" processorArchitecture="amd64" />
          <bindingRedirect oldVersion="2.0.0.0-10.9.9.9" newVersion="2.102.3.2" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

The key here is the processorArchitecture="amd64", this means the replacement only happens when running under 64-bit.

Note these versions may be out of date now (if you're reading this caring about Oracle specifically), this was a while back. In addition to the config, we loaded the 32-bit and 64-bit versions of Oracle.DataAccess into the GAC. The 32-bit versions are 10.xxx for Oracle 10g, the 64-bit versions are 2.1xxx, so just swapping the binding using <assemblyBinding> works.

The second, more long-term solution was moving off the Oracle client completely, we're now using dotConnect for Oracle for our Linq-to-SQL provider, and since it's completely managed code using a direct TCP connection, we have no more 32/64-bit specific code in the application, which is much easier to maintain.

I hope whoever finds this also finds the follow-up useful as well. If you have questions about either solution I ended up using, please comment and I'll try and explain in more detail.

解决方案

Two ideas:

  1. Cobble something together with XSP from the Mono project.
  2. Test in a totally 32bit environment, deploy to a 64bit environment.

这篇关于如何在 x64 中使用 WebDev.WebServer.exe (VS Web Server)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆