服务器.传输到内部虚拟应用程序

发布于 2024-08-13 15:35:38 字数 1111 浏览 5 评论 0原文

我的问题是如何管理位于同一主机的多个虚拟应用程序

firstdomain.com被重定向到firstdomain.com/1 secondarydomain.com 被重定向到 secondarydomain.com/2 等等... 每个新域必须位于不同的文件夹中,目前工作正常。 但这会造成一些不方便,例如第二个域名.com/1 显示的是第一个域名.com 网站。

我正在尝试在根目录“/”创建类似调度的内容,以使用 Server.Transfer("") 传输必要的域。

但它并不像我想象的那样工作:

Server.Transfer("/" + folder + "");

导致此错误:

“/”应用程序中的服务器错误。错误 执行子请求 /web_folder。

描述:未处理的 期间发生异常 执行当前的网络请求。 请查看堆栈跟踪以了解更多信息 有关错误及其位置的信息 它起源于代码。

异常详细信息: System.Web.HttpException:错误 执行子请求 /web_folder。

Server.Execute("/" + folder + "");

也会导致错误:

执行子请求时出错 /web_folder。

描述:未处理的异常 执行期间发生的 当前的网络请求。请查看 堆栈跟踪以获取有关的更多信息 错误及其起源 代码。

异常详细信息: System.Web.HttpException:错误 执行子请求 /web_folder。

这两个应用程序都可以通过其指定的 url 正常访问。

而且两个应用程序也存在问题,如果我使用根 web.config 中的 HttpModules,则会导致虚拟应用程序内部出现编译错误。如果我在虚拟站点中添加对同一项目的引用,它可能会通过。

有什么建议吗?

我认为必须有任何解决方案,很多人需要将任何子域重定向到不重定向的子文件夹,以保留原始URL dsplay,

谢谢。

My question is how to manage several virtual applications, located at the same host

firstdomain.com is redirected to firstdomain.com/1
seconddomain.com is redirected to seconddomain.com/2
and so on...
each new domain must be located at different folder, and for now it is working fine.
But it causes some inconvenient, for example seconddomain.com/1 is showing firstdomain.com web site.

i'm trying to create something like dispatch at root directory "/" to transfer necesary domain with Server.Transfer("").

but it is not working like I thought:

Server.Transfer("/" + folder + "");

causes this error:

Server Error in '/' Application. Error
executing child request for
/web_folder.

Description: An unhandled
exception occurred during the
execution of the current web request.
Please review the stack trace for more
information about the error and where
it originated in the code.

Exception Details:
System.Web.HttpException: Error
executing child request for
/web_folder.

Server.Execute("/" + folder + "");

causes error too:

Error executing child request for
/web_folder.

Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.

Exception Details:
System.Web.HttpException: Error
executing child request for
/web_folder.

both applications works fine accessed by its specified url.

and also there is a problem with two applications, if I use HttpModules from root web.config, it causes compilation error inside virtual application. It may be passed, if I add reference to same project in virutal site.

Any suggestions ?

i think there must be any solution, many people need to redirect any subdomain to a subfolder without Redirect, to keep the original URL dsplay

thanks.

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

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

发布评论

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

评论(2

薄暮涼年 2024-08-20 15:35:38

您无法Server.Transfer 到托管在 IIS 中与执行请求的虚拟目录不同的应用程序。

You cannot Server.Transfer to an application that is hosted to a different virtual directory in IIS than the one that's performing the request.

娇妻 2024-08-20 15:35:38

Server.Transfer 只能发生在单个 HttpContext 上。每个虚拟目录或应用程序都有自己的 HttpContext 对象,但它们不知道它们是共存的!所以你不能那样做。

Server.Transfer can only happen for single HttpContext. Each virtual directory or app has its own HttpContext object and they know not that co-exists! so you cannot do that.

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