如何为 ASP.NET“网站”设置平台目标项目
我不断遇到“网站项目”与“Web 应用程序项目”之间的各种细微差别 - 这是对我来说最新的:
我继承了一个包含几个类库项目(一个 DAL.dll、一个Biz.dll 等),但这都是由网站项目“前置”的,而不是 Web 应用程序项目。
虽然网络应用程序项目提供了平台目标下拉列表(任何CPU、x86、x64),但可怜的网站项目似乎没有提供任何类似的东西。 有没有办法确保网站在 64 位 IIS 计算机上托管时以 x86 运行?
..我问这个问题的大局是:
该网站在 64 位计算机(Win Server 2003)上运行,并且[我刚刚了解到]无法加载我认为已包装的 32 位 COM 对象带有运行时可调用包装器。因为它无法加载这一部分,所以设置了一个 web.config 设置,通过绕过这个 32 位 dll 的加载来避免运行时加载错误(但是当站点在 64 位上运行时,COM dll 的所有功能都会“丢失”)位机)。
因此,总而言之,我假设 64 位计算机上的网站必须作为 64 位应用程序在 IIS 中运行,并且如果我可以让该网站以 32 位运行,那么它可以加载COM dll,因此执行应用程序的该功能。
注意:我已经并且仍然在这里进行研究,以准备当我访问实际的开发环境时快速吸收,因此我的大部分问题都是基于将我很快将面临的[预期]问题的各个部分拼凑在一起。谢谢。
I keep running into all sorts of nuances between the "web site project" versus "web application project" - here is the latest for me:
I've inherited a Visual Studio 2005 solution with several class library projects (a DAL.dll, a Biz.dll, etc.) but this is all "fronted" by a web site project rather than a web app project.
While the web app project provides a Platform Target dropdown list (Any CPU, x86, x64), the poor web site project appears to offer nothing like that. Is there a way to ensure the web site runs as x86 when hosted on a 64bit IIS machine?
..The bigger picture of why I am asking this:
The website runs on a 64bit machine (Win Server 2003) and [I have just learned] cannot load a 32bit COM object which I believe has been wrapped with a Runtime Callable Wrapper. Because it cannot load this piece, a web.config setting is set to avoid the runtime load error by bypassing the load of this 32bit dll (but all of the functionality of COM dll is therefore "lost" when the site is running on a 64 bit machine).
So, in summary, I presume the web site on the 64bit machine must be running in IIS as a 64bit app and that if I could just get the site to run as 32bit instead, then it could load the COM dll and therefore execute that functionality of the application.
NOTE: I have been and still am doing research here in preparation for a quick uptake when I get access to the actual development environment so much of my question is based on piecing together parts of my [anticipated] problems to be faced soon. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,在服务器 03 下,您不能在 IIS 中同时拥有 64 位和 32 位应用程序池。
您可以强制它在 32 位模式下运行,但这会影响所有应用程序池,从而影响所有站点/应用程序。这听起来应该可以解决您的 COM 问题,但它可能会影响该机器上运行的任何其他内容,因此请注意这一点。公平地说,从 64 位切换到 32 位产生影响的机会比反之亦然要小。唯一想到的必须在 64 位应用程序池中运行的常见问题是 Exchange 07。话虽如此,我是一名开发人员,而不是服务器管理员。
如果您确定,请查看 此处
顺便说一句,服务器 08 可以同时支持 64 位和 32 位应用程序池。
As far as im aware, under server 03 you cant have 64 bit and 32 bit application pools in IIS side by side.
You can force it run in 32bit mode but this would affect all application pools, and therefore all sites / apps. This sounds like it should fix your COM issue but it might have an effect on any thing else running on that box so be aware of that. To be fair the chances of switching from 64 bit down to 32 effecting things are less than vice versa. The only common thing that springs to mind that must be ran in a 64 bit applicaiton pool is Exchange 07. Having said that im a dev, not a server admin.
If your sure, look here
Btw, server 08 can rock both 64 bit and 32 bit app pools simultaneously.
网站项目似乎没有 x86/x64 目标,只有 Any CPU 目标。因此,您必须通过控制应用程序池的位数来控制网站的位数。
在 Windows Server 2008 或 Windows 7 上,如果您想创建 32 位 AppPool,请进入 IIS Manager > [服务器名称]>应用程序池>高级设置。对于要作为 x86 进程运行的应用程序池,将“启用 32 位应用程序”设置为“True”。
请注意,您必须考虑其他 WOW64 考虑因素,例如,您的 Web 应用程序访问的注册表设置现在将使用 [HKLM\Software\Wow6432Node] 键而不是 [HKLM\Software] 键。
There appears to be no x86/x64 target for web site projects, only the Any CPU target. You therefore have to control the bitness of your website by controlling the bitness of your app pool.
On Windows Server 2008 or Windows 7, if you want to make an AppPool 32-bit, go into the IIS Manager > [Server Name] > Application Pools > Advanced Settings. Set "Enable 32-Bit Applications" to "True" for the app pool you want to run as an x86 process.
Note that you will have to take other WOW64 considerations into account, for example, registry settings accessed by your web app will now use the [HKLM\Software\Wow6432Node] key instead of the [HKLM\Software] key.