在 IIS 6 中托管 .NET 4.0 Web 服务

发布于 2024-10-16 10:38:30 字数 1338 浏览 11 评论 0原文

我正在尝试托管第二个网站(在已使用的默认网站之外),该网站是 .NET 4 支持的 Web 服务。这是 IIS 6。

默认网页使用 .NET 2.0。在 IIS 6 中,通过创建两个不同的应用程序池,您可以让两个独立的网站运行不同版本的 .NET。我已经做到了这一点。

但是,我遇到了一个常见问题,即 ASP.NET 选项卡未出现在 IIS 中。该选项卡允许您设置站点使用的 .NET 版本。

我的解决方法是更改​​每个站点通过命令行引用的 .NET 版本:

aspnet_regiis -s (site path)

此问题的另一个解决方案是将 IIS 切换到 64 位模式,这会导致 ASP.NET 选项卡实际出现。问题在于,即使在重新配置 IIS 以引用以下目录(

Microsoft.NET/Framework64

而不是

Microsoft.NET/Framework)

之后,将 IIS 切换到 64 位也无法与 现有网站很好地配合。一台这样的服务器?这是一场噩梦。我实际上可以让第二页正常工作,但原始默认页面会失败,反之亦然。

现在,我的 IIS 处于 32 位模式,并从 cmd 行运行以下命令:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -lk
W3SVC/  2.0.50727.3053
W3SVC/1/ROOT/   2.0.50727.3053
W3SVC/87257621/root/    4.0.30319.1

这清楚地表明我的第二个网站(ID 8725721)设置为 .NET 4,而原始设置(ID 1)设置为 .NET 2它们位于不同的应用程序池中。

在此配置下,初始站点可以正常工作。在新站点上,我可以浏览目录,但 .asmx 页面会产生 404 错误。

当我为 64 位模式启用 IIS 时,我已经使 .asmx 页面按预期工作,但随后默认网站给出了“服务不可用”一般错误,因为 .NET 是从 Framework 路径而不是 Framework64 路径安装的。然而,即使切换到 Framework64 路径后,默认页面也会出现更多错误。

另外,在我更改网站的目标框架之前,我尝试运行到 .NET 4,事件查看器中显示此错误:

无法初始化 AppDomain:/LM/W3SVC/87257621/Root

异常:System.IO.FileLoadException

消息:无法加载文件或程序集“System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。访问被拒绝。

I am trying to host a 2nd website (outside of Default Web Site, which is already used) that is a web service supported by .NET 4. This is IIS 6.

The Default web page is using .NET 2.0. In IIS 6 you can have two seperate websites running different versions of .NET by creating two distinct application pools. I've done this.

However I am running into a common problem where the ASP.NET tab does not appear in IIS. That tab allows you to set which version of .NET a site uses.

My workaround is to change the .NET version that each site references through command line:

aspnet_regiis -s (site path)

The other solution to this problem is to switch IIS to 64-bit mode, which causes the ASP.NET tab to actually appear. The problem is that switching IIS to 64-bit does not jive well with the existing website, even after reconfiguring IIS to reference the following directory,

Microsoft.NET/Framework64

as opposed to

Microsoft.NET/Framework

Is anyone experienced with hosting seperate pages on one server like this? This is a nightmare. I can actually get the 2nd page to work, but then the original default page fails, and vice versa.

I now have IIS in 32-bit mode and ran the following from cmd line:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -lk
W3SVC/  2.0.50727.3053
W3SVC/1/ROOT/   2.0.50727.3053
W3SVC/87257621/root/    4.0.30319.1

Which shows clearly that my 2nd website (which has ID 8725721) is set for .NET 4 whereas the original set (ID 1) is set for .NET 2. They are in seperate application pools.

Under this configuration the initial site works. On the new site I can browse the directory but the .asmx page produces a 404 error.

I have gotten the .asmx page to work as intended, when I enabled IIS for 64-bit mode, but then the default web site gave a 'Service unavailable' generic error because .NET was installed from the Framework path rather than Framework64 path. However even after switching to the Framework64 path more errors came up from the default page.

Also, before I change the target framework of the website Im trying to run to .NET 4, this error shows up in the Event Viewer:

Failed to initialize the AppDomain:/LM/W3SVC/87257621/Root

Exception: System.IO.FileLoadException

Message: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵情客 2024-10-23 10:38:30

在 IIS 中的 Web 服务扩展下,ASP.NET 4.0 是否设置为允许?

Under the web service extensions in IIS, is ASP.NET 4.0 set to allowed?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文