oracle 如何在 x64 中使用 WebDev.WebServer.exe (VS Web Server)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/837285/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to utilize WebDev.WebServer.exe (VS Web Server) in x64?
提问by Nick Craver
Visual Studio is x86 until at least the 2010 release comes aroundupdate: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?
Visual Studio 是 x86 ,至少在 2010 版本出现更新之前:这仍然是 VS2010 中的一个问题,没有本机 64 位 Cassini 支持。我的问题是任何人都可以想出一种方法或知道 2008 年或 2010 年的 x64 独立 ASP.NET 调试服务器吗?
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).
背景:我们的 ASP.NET 应用程序针对作为数据库的 Oracle 运行。由于我们稍后在 64 位服务器上处理内存问题,因此我们需要使用 Oracle 的 64 位驱动程序(即时客户端)。
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 SP1Visual Studio 2010
- x64 操作系统(XP 或 Windows 7)
- IIS(6 或 7,均为 x64 应用程序池)
- Oracle 64 位即时客户端(单独的目录,在 PATH 中)
Visual Studio 2008 SP1Visual Studio 2010
In IIS the application pool runs as 64-bit, uses the Oracle drivers as intended, however since WebDev.WebServer.exeis 32-bit you'll get a BadImageFormatExceptionbecause 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.
在 IIS 中,应用程序池作为 64 位运行,按预期使用 Oracle 驱动程序,但是由于WebDev.WebServer.exe是 32 位,您将收到BadImageFormatException,因为它试图以 32 位加载 64 位驱动程序 DLL环境。我们所有的开发人员都希望能够通过 Visual Studio 2008 使用快速调试服务器,但由于它以 32 位运行,我们无法做到。我们遇到的一些问题是在应用程序启动期间,所以虽然我们有时会附加到 IIS 进程,但这还不足以追踪问题。
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.
是否有任何替代方案或解决方法?我们希望尽可能匹配我们的 Dev/Val/Prod 层,因此在 x64 中运行的所有内容都是理想的。
Update for VS 2010
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:
这个问题自从第一次发布以来发生了很多变化,第一个 VS2010 现在已经出来了,它在这里仍然存在相同的问题,但是我所在的项目没有。我们进行了 2 处更改来解决此问题,因此我将发布这些更改,希望能减轻其他人的痛苦:
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:
第一个解决方案是在 32 位模式下加载更多 Oracle x86,在 64 位模式下加载 x64,我们通过 web.config 在 64 位下运行时替换程序集引用来做到这一点,如下所示:
<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.
这里的关键是processorArchitecture="amd64"
,这意味着替换仅在 64 位下运行时发生。
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.
请注意,这些版本现在可能已经过时(如果您正在阅读这篇特别关注 Oracle 的内容),那是很久以前的事了。除了配置,我们将 32 位和 64 位版本加载Oracle.DataAccess
到 GAC 中。32 位版本适用10.xxx
于 Oracle 10g,64 位版本适用于2.1xxx
,因此只需使用<assemblyBinding>
works交换绑定即可。
The second, more long-term solution was moving off the Oracle client completely, we're now using dotConnect for Oraclefor 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 mucheasier to maintain.
第二个更长期的解决方案是完全脱离 Oracle 客户端,我们现在将dotConnect for Oracle用于我们的 Linq-to-SQL 提供程序,并且由于它是使用直接 TCP 连接的完全托管代码,因此我们没有更多的 32应用程序中的 /64 位特定代码,更易于维护。
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.
我希望任何发现这一点的人也会发现后续行动也很有用。如果您对我最终使用的任一解决方案有疑问,请发表评论,我会尝试更详细地解释。
采纳答案by xanadont
回答by ZippyV
Use IIS on your local machine.
在本地机器上使用 IIS。
回答by Zia
Even you are using 64-bit environment, temporary refer 32-bit dlls in Visual studio (or manual copy it in BIN folder) so that you can debug it. Keep in mind, every time you compile the code it will re-copy the 64-bit assemblies in BIN folder.
即使您使用的是 64 位环境,也可以在 Visual Studio 中临时引用 32 位 dll(或手动将其复制到 BIN 文件夹中),以便您可以对其进行调试。请记住,每次编译代码时,它都会重新复制 BIN 文件夹中的 64 位程序集。