ASP.NET虚拟路径映射到另一个不允许的应用程序

时间:2021-09-30 09:25:04

I have a website that was building without any issue on multiple servers.
But, when I copy/move it on the same machine from one folder to another folder: I started getting the error

我有一个网站,在多个服务器上没有任何问题。但是,当我在同一台机器上将其从一个文件夹复制/移动到另一个文件夹时:我开始收到错误

The Virtual Path Maps To Another Application Which Is Not Allowed.

虚拟路径映射到另一个不允许的应用程序。

What am I doing wrong?

我究竟做错了什么?

3 个解决方案

#1


10  

The source of this problem is that when one copies an ASP.NET Web Site to a new folder -- the properties setting associated with the solution "Virtual Path" is set to the folder name and not the root. The solution is to change the Virtual Path setting from the folder name to "/".

此问题的根源是,当将ASP.NET网站复制到新文件夹时 - 与解决方案“虚拟路径”关联的属性设置将设置为文件夹名称而不是根目录。解决方案是将虚拟路径设置从文件夹名称更改为“/”。

This can be found by right click the project and opening the properties dialog: Solution->Properties->Virtual Path-> Change to "/"

右键单击项目并打开属性对话框即可找到:解决方案 - >属性 - >虚拟路径 - >更改为“/”

#2


0  

Additional check: Missing global.asax also causes the same error.

附加检查:缺少global.asax也会导致相同的错误。

#3


0  

This isn't why your error happened but it may be useful to someone researching the problem who ends up here.

这不是您的错误发生的原因,但对于研究问题的人来说,这可能是有用的。

If your web app is running as an application within another IIS site (set via the IIS administration tool) and is attempting to reach resources of the other site by means such as HttpResponse.Redirect, make sure the project isn't set to use a separate IIS in Visual Studio. If it is, it may be firing up inside a different IIS than the rest of the site.

如果您的Web应用程序作为另一个IIS站点中的应用程序(通过IIS管理工具设置)运行,并且尝试通过HttpResponse.Redirect等方式访问其他站点的资源,请确保该项目未设置为使用在Visual Studio中单独的IIS。如果是,它可能会在与站点其余部分不同的IIS内部启动。

#1


10  

The source of this problem is that when one copies an ASP.NET Web Site to a new folder -- the properties setting associated with the solution "Virtual Path" is set to the folder name and not the root. The solution is to change the Virtual Path setting from the folder name to "/".

此问题的根源是,当将ASP.NET网站复制到新文件夹时 - 与解决方案“虚拟路径”关联的属性设置将设置为文件夹名称而不是根目录。解决方案是将虚拟路径设置从文件夹名称更改为“/”。

This can be found by right click the project and opening the properties dialog: Solution->Properties->Virtual Path-> Change to "/"

右键单击项目并打开属性对话框即可找到:解决方案 - >属性 - >虚拟路径 - >更改为“/”

#2


0  

Additional check: Missing global.asax also causes the same error.

附加检查:缺少global.asax也会导致相同的错误。

#3


0  

This isn't why your error happened but it may be useful to someone researching the problem who ends up here.

这不是您的错误发生的原因,但对于研究问题的人来说,这可能是有用的。

If your web app is running as an application within another IIS site (set via the IIS administration tool) and is attempting to reach resources of the other site by means such as HttpResponse.Redirect, make sure the project isn't set to use a separate IIS in Visual Studio. If it is, it may be firing up inside a different IIS than the rest of the site.

如果您的Web应用程序作为另一个IIS站点中的应用程序(通过IIS管理工具设置)运行,并且尝试通过HttpResponse.Redirect等方式访问其他站点的资源,请确保该项目未设置为使用在Visual Studio中单独的IIS。如果是,它可能会在与站点其余部分不同的IIS内部启动。