部署MVC2应用IIS7.5 - Ninject要求提供控制器的内容文件 [英] Deploying MVC2 application to IIS7.5 - Ninject asked to provide controllers for content files

查看:286
本文介绍了部署MVC2应用IIS7.5 - Ninject要求提供控制器的内容文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有开始作为一个MVC(1.0)的应用程序在Visual Studio 2008 SP1和一帮Silverlight 3的项目作为网站的一部分的应用程序。没什么特别的。使用Ninject依赖注入(第2版测试版,目前发布的版本2和MVC扩展)。

I have an application that started life as an MVC (1.0) app in Visual Studio 2008 Sp1 with a bunch of Silverlight 3 projects as part of the site. Nothing fancy at all. Using Ninject for dependency injection (first version 2 beta, now the released version 2 with the MVC extensions).

在.NET 4.0,VS2010,MVC2等的发布,我们决定将应用到最新的平台。在VS2010的转换向导显然照顾了一切,但有一个例外 - 它并没有改变引用MVC1到现在指向MVC2,所以我不得不这样做手工。当然,这让我想到其他MVC2的东西,可以从我的应用程序缺失,这将是那里,如果我这样做文件 - >新建项目...但是,这并不是这个问题的焦点

With the release of .Net 4.0, VS2010, MVC2 etc., we decided to move the application to the newest platform. The conversion wizard in VS2010 apparently took care of everything, with one exception - it didn't change references to mvc1 to now point to mvc2, so I had to do that manually. Of course, this makes me think about other MVC2 things that could be missing from my app, that would be there if I did File -> New Project... But that is not the focus of this question.

当我部署的应用到IIS 7.5服务器(在Win2008的R2 x64的运行),应用这样的作品。然而,图像,脚本和其他静态内容似乎不存在。当然他们在那里在磁盘上在服务器上,但他们并不在客户端的web浏览器中显示。

When I deploy this application to the IIS 7.5 server (running on Win2008 R2 x64), the application as such works. However, images, scripts and other static content doesn't seem to exist. Of course they are there on disk on the server, but they don't show up in the client web browser.

我是相当新的IIS,所以我知道的唯一的诀窍就是尽量在服务器上的浏览器打开网页,因为这可以给我更多的信息。在这里,最后,我们满足我们的敌人。如果我尝试直接到图像上(http://server/Content/someimage.jpg为例)之一的URL,我得到在浏览器中出现以下错误:

I am fairly new to IIS, so the only trick I knew is to try to open the web page in a browser on the server, as that could give me more information. And here, finally, we meet our enemy. If I try to go directly to the URL of one of the images (http://server/Content/someimage.jpg for instance), I get the following error in the browser:

在IControllerFactoryNinject.Web.Mvc.NinjectControllerFactory未返回控制器,一个名为内容的控制器。

The IControllerFactory 'Ninject.Web.Mvc.NinjectControllerFactory' did not return a controller for a controller named 'Content'.

啊哈。该网站的服务器尝试满足这种要求,MVC,谁与它的默认路由设置假设的内容是一个控制器,而失败。

Aha. The web server tries to feed this request to MVC, who with its' default routing setup assumes Content to be a controller, and fails.

我怎样才能得到它来治疗内容/和脚本/(其中包括)非控制器,只是通过静态内容?当然,这可与卡西尼号在我开发的机器,但是当我部署,这个问题命中。

How can I get it to treat Content/ and Scripts/ (among others) as non-controllers and just pass through the static content? This of course works with Cassini on my developer machine, but as soon as I deploy, this problem hits.

我使用Ninject MVC 2的最后一个版本,其中的IoC工具应该通过缺失控制器为基础的控制器工厂,但这显然没有帮助。我也尝试添加忽略的内容等途径,但这显然没有影响无论是。我甚至不知道我是在正确的层面解决问题。

I am using the last version of Ninject MVC 2 where the IoC tool should pass missing controllers to the base controller factory, but this has apparently not helped. I have also tried to add ignore routes for Content etc., but this apparently has no effect either. I am not even sure I am addressing the problem on the right level.

有谁知道去哪里找得到这个程序回事?我有完全控制Web服务器,所以我可以或多或少地做任何我想它,只要它开始工作。

Does anyone know where to look to get this app going? I have full control of the web server so I can more or less do whatever I want to it, as long as it starts working.

谢谢!

推荐答案

原来,这是由一些帐户设置引起的 - 我不知道会自动由IIS中的Win2008 R2服务器创建的IIS程序池\站点名的帐户。在尝试一切,我碰到这个信息,给了适当的权利,和东西奇迹般地开始工作。

Turns out this was caused by some account settings - I was unaware of the IIS AppPool\sitename account automatically being created by IIS in Win2008 R2 server. After trying "everything", I came across this information, gave the proper rights, and stuff magically started working.

pretty的辛苦的事情调试,尤其是对某人(我)非常有限的IIS的经验。

Pretty hard thing to debug, especially for someone (me) with very limited IIS experience.

这篇关于部署MVC2应用IIS7.5 - Ninject要求提供控制器的内容文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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