一个IIS网站可以承载不同的ASP.NET版本的多个Web应用程序? [英] Can One IIS WebSite host multiple Web Applications of different ASP.NET versions?

查看:165
本文介绍了一个IIS网站可以承载不同的ASP.NET版本的多个Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS中的网站,我想有第2版,3.5,和相同的IIS网站托管在4应用程序。这可能吗?

I have one web site in IIS, and I would like to have version 2, 3.5, and 4 applications hosted under the same IIS web site. Is this possible?

想那会是修改web.config文件一样简单。我至今就是我创建的根的ASP.NET 3.5网站。然后,我创建了一个目录下,并部署了一个ASP.NET 2.0的网站。到目前为止,当我查看该网站的3.5,它认为罚款。 2.0的网站,但是,当我浏览到该目录下的Default.aspx的,我得到:

Thought it'd be as easy as modifying the web.config. What I have so far is I created an ASP.NET 3.5 site on the root. Then I created a directory underneath and deployed an ASP.NET 2.0 site. So far, when I view the 3.5 site, it views fine. The 2.0 site, however, when I browse to the directory's default.aspx, I get:

说明:该请求提供服务所需资源的分析过程中出现错误。请检查下列特定分析错误详细信息并适当地修改源文件。

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

有什么想法?

感谢。

更新,以显示完整的错误(不知道是否有帮助)

UPDATED to show full error (not sure if it helps)

推荐答案

您需要为每一个web应用程序单独的IIS应用程序。巧合的是,单独的应用程序可以有单独的应用程序池,这反过来又可以有单独的.NET framework版本。

You need separate IIS Applications for each web app. Coincidentally, separate apps can have separate App Pools, which in turn can have separate .NET framework versions.

但是,这不是您的问题

在您的应用程序的情况下,您遇到一个.NET 2.0的Web应用程序和.NET 3.5的Web应用程序,它使用.NET的相同版​​本(CLR 2.0)的问题。你看到的问题是因为子应用程序没有被标记为一个单独的应用程序,所以运行时找错了地方装配加载你的类型。

In the case of your app, you're having issues with a .NET 2.0 web app and a .NET 3.5 web app, which use the same version of .NET (CLR 2.0). The issue you're seeing is because the sub-app isn't marked as a separate application, so the runtime is looking in the wrong place for the assembly to load your type.

您的网站内容大概是这个样子:

Your site contents probably look something like this:

root (~/)
- bin
  * app.dll
- sub-app
  - bin
    * subapp.dll

当subapp运行时,它试图加载类型Second.Namespa._Default,但装配路径是到〜/斌(根/箱),其中不包含正确的装配。如果选中的子应用程序为IIS自己的应用程序,你会得到这样的:

When the subapp runs, it's trying to load type Second.Namespa._Default, but the assembly path is to ~/bin (root/bin), which doesn't contain the correct assembly. If you mark sub-app as its own application in IIS, you'll get this:

root (~/)
- bin
  * app.dll
- sub-app (~/ again for anything below)
  - bin
    * subapp.dll

现在加载Second.Namespa._Default会看在〜/斌(现为子应用程序/箱),并找到正确的装配和能够加载的类型。

Now loading Second.Namespa._Default will look in the ~/bin (now sub-app/bin), and find the correct assembly and be able to load the type.

这篇关于一个IIS网站可以承载不同的ASP.NET版本的多个Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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