为什么我的ASP.NET MVC应用程序可以从虚拟目录运行,但不能从网站运行?

时间:2022-02-04 03:32:50

I created an ASP.NET MVC application on my local computer under IIS 7.5 (Windows 7 RC) in a virtual directory (like http://localhost/MyApp).

我在IIS 7.5(Windows 7 RC)下的本地计算机上的虚拟目录(如http:// localhost / MyApp)中创建了一个ASP.NET MVC应用程序。

Now that I'm trying to deploy it to a remote server I get strange results. The application seems to route every request to the Forms Authentication login form, and requests for static content (from the /Content directory) result in exceptions for not being able to create a controller.

现在,我正在尝试将其部署到远程服务器,我得到了奇怪的结果。应用程序似乎将每个请求路由到Forms Authentication登录表单,并且对静态内容的请求(来自/ Content目录)导致无法创建控制器的异常。

When I deploy the same application to a virtual directory on the remote server, everything works as expected.

当我将相同的应用程序部署到远程服务器上的虚拟目录时,一切都按预期工作。

I was expecting some small problems like url's not pointing correctly and other minor fixups, but not this.

我期待一些小问题,比如url没有正确指向和其他小修正,但不是这个。

Any idea as to why this is happening and what I can do to diagnose the problem is welcome.

任何想法为什么会发生这种情况以及我能做些什么来诊断这个问题都是值得欢迎的。

Update:

For some reason, it works now, and I can't figure out what I did to make it work. This bothers me, not only because now I can't investigate further what went wrong. Also because now I have no answer to this question. I'm going to leave it open so that anyone can still make suggestions.

由于某种原因,它现在有效,我无法弄清楚我做了什么使它工作。这困扰我,不仅因为现在我无法进一步调查出了什么问题。也因为现在我对这个问题没有答案。我打算把它打开,这样任何人都可以提出建议。

2 个解决方案

#1


1  

I had to deploy an ASP.NET MVC site to a remote server that did not have ASP.NET MVC installed once and had to do the following to get it to work:

我不得不将ASP.NET MVC站点部署到没有安装ASP.NET MVC的远程服务器,并且必须执行以下操作才能使其工作:

  • bin deploying the ASP.NET MVC dll files
  • bin部署ASP.NET MVC DLL文件

  • Changing my routes to use {controller}.aspx (as the aspx file extension was already registered to process ASP.NET requests and I didn't have access to the actual server)
  • 更改我的路由以使用{controller} .aspx(因为aspx文件扩展名已经注册以处理ASP.NET请求而我无法访问实际的服务器)

Hope this helps in some was - although obviously your situation might be completely different and the above might be no help whatsoever :-)

希望这在某些方面有所帮助 - 尽管显然你的情况可能完全不同,以上可能没有任何帮助:-)

#2


0  

You likely need to grant read/execute permission to the files/folder that you are deploying to for the windows account that the App Pool of the website on the remote server is running under.

您可能需要为正在运行的远程服务器上的网站的应用程序池的Windows帐户授予您正在部署的文件/文件夹的读取/执行权限。

#1


1  

I had to deploy an ASP.NET MVC site to a remote server that did not have ASP.NET MVC installed once and had to do the following to get it to work:

我不得不将ASP.NET MVC站点部署到没有安装ASP.NET MVC的远程服务器,并且必须执行以下操作才能使其工作:

  • bin deploying the ASP.NET MVC dll files
  • bin部署ASP.NET MVC DLL文件

  • Changing my routes to use {controller}.aspx (as the aspx file extension was already registered to process ASP.NET requests and I didn't have access to the actual server)
  • 更改我的路由以使用{controller} .aspx(因为aspx文件扩展名已经注册以处理ASP.NET请求而我无法访问实际的服务器)

Hope this helps in some was - although obviously your situation might be completely different and the above might be no help whatsoever :-)

希望这在某些方面有所帮助 - 尽管显然你的情况可能完全不同,以上可能没有任何帮助:-)

#2


0  

You likely need to grant read/execute permission to the files/folder that you are deploying to for the windows account that the App Pool of the website on the remote server is running under.

您可能需要为正在运行的远程服务器上的网站的应用程序池的Windows帐户授予您正在部署的文件/文件夹的读取/执行权限。