在 Windows XP 32 位上开发 Windows Server 2003 64 位 [英] Developing for Windows Server 2003 64 bit on Windows XP 32 bit

查看:24
本文介绍了在 Windows XP 32 位上开发 Windows Server 2003 64 位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在 Windows XP Professional 上开发 ASP.NET 应用程序.在升级到生产时,我现在才发现服务器是 64 位的.我在服务器上安装了 32 位 Oracle 客户端,但无法连接到 Oracle.

我正在使用 Microsoft Provider for Oracle,我的问题是,如何在 32 位机器上编译 ASP.NET 应用程序以连接到 Windows Server 2003 64 位机器上的 Oracle?

在回复对我的原始问题的评论时,我得到的错误是尝试加载 Oracle 客户端库引发了 BadImageFormatException.在安装了 32 位 Oracle 客户端组件的情况下以 64 位模式运行时会出现此问题"

我已经卸载了 32 位客户端并正在安装 64 位客户端,问题是服务器是 DMZ 中的生产服务器,我自己无法访问服务器,所以我试图预测任何问题我将在安装 64 位客户端时尝试访问服务器上的 ASP.NET 应用程序

解决方案

简单的解决方案:您应该根据平台(x64 机器上的 x64)安装 Oracle 客户端.原因是您的 .NET 应用程序很可能是在 AnyCPU 配置中构建的,这意味着它将在 x64 平台上作为 x64 应用程序运行.然后它只能加载 x64 本机库...

注意说到Oracle,我喜欢用Oracle即时客户端:

  • 您无需在目标机器上安装任何东西(包括开发箱!).
  • 您可以确保您的应用程序将在您选择的特定客户端(版本、x86/x64)上运行.
  • 您甚至可以轻松地让多个应用程序在同一台计算机上使用不同的客户端版本.
  • 不利的一面是,它会显着增加您的应用程序的权重(最低约 19Mb).

检查 将 C# 连接到 Oracle 数据库所需的最小客户端占用空间是多少?了解更多信息.

在您的特定情况下,我建议设置一个可以在 x86 和 x64 机器上运行的 Visual Studio 项目:查看我的博客文章 Visual Studio 中的 Oracle Instant Client.然后这里是关于 如何配置 WiX 包的指南适用于面向 x86 或 x64 计算机的 Oracle Instant Client.如果您使用其他部署策略,请确保根据目标平台提供正确的客户端.

I have been developing an ASP.NET application on Windows XP Professional. While promoting to production I have only now found out that the server is 64 bit. I installed Oracle Client 32 bit on the server and cannot connect to Oracle.

I am using the Microsoft Provider for Oracle, and my question is, how do I get an ASP.NET application compiled on a 32 bit machine to connect to Oracle on a Windows Server 2003 64 bit machine?

EDIT:

In response to a comment on my original question, the error I am getting is "Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed"

I have uninstalled the 32 bit client and am getting the 64 bit client installed, the problem is that the server is a production server in a DMZ and I have no access to the server myself, so I am trying to anticipate any problems I will have when the 64 bit client is installed and I try to access the ASP.NET application on the server

解决方案

Straightforward solution : you should install the Oracle client according to the platform (x64 on a x64 machine). The reason is that your .NET application is very likely to be built in AnyCPU configuration, which means it will run as a x64 application on a x64 platform. It then can only load x64 native libraries...

Note that when it comes to Oracle, I like to use Oracle Instant Client :

  • You don't have to install anything on the target machines (including dev boxes !).
  • You can make sure that your application will run with the specific client you picked (version, x86/x64).
  • You could even easily have multiple applications work with different client versions on the same computer.
  • As a downside, it adds a significant weight to your application (~19Mb minimum).

Check What is the minimum client footprint required to connect C# to an Oracle database? for more information.

In your particular case, I recommend setting up a Visual Studio project that will work on x86 as well as x64 machines : check my blog post Oracle Instant Client in Visual Studio. Then here is a guidance on how to configure a WiX package for Oracle Instant Client targeting x86 or x64 machines. If you use another deployment strategy, just make sure you ship the correct client according to the target platform.

这篇关于在 Windows XP 32 位上开发 Windows Server 2003 64 位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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