asp.net-mvc - 为什么 Ninject 在部署到 Azure 时会抛出 "did not return a controller"异常?

标签 asp.net-mvc azure ninject

我刚刚将基于 MVC 的 Web 服务部署到 Azure。它在专用服务器上运行良好。它使用 Ninject。

部署到 Azure 时,我收到以下错误:

The IControllerFactory 'xxx.NinjectControllerFactory' did not return a controller for the name '<DeploymentName>'.

其中 是生产部署的名称(或托管服务 - 两者具有相同的名称) - 这看起来有点奇怪。

我正在使用 NuGet 的最新版本的 Ninject (2.2.0.0)。我的理解是 1.x 中存在中等信任问题,但 2.x 中没有。

有人能指出我在这方面的正确方向吗?正如我所说,它在非 Azure 部署中运行良好 - 而且我在许多 MVC 3 Web 应用程序中使用了相同的代码,没有出现任何问题,因此它看起来确实像是一些特定于 Azure 的问题。

最佳答案

我知道一些使用 Ninject.MVC3 的项目在 Azure 上成功运行。您应该尝试使用此扩展,而不是实现您自己的 NinjectControllerFactory。否则问题很可能出在您的 ControllerFactory 而不是 Ninject。

关于asp.net-mvc - 为什么 Ninject 在部署到 Azure 时会抛出 "did not return a controller"异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8791947/

相关文章:

asp.net-mvc - ASP.NET MVC 中的 OAuth google 连接

c# - Azure 存储客户端 v4.1 - 预期为非基本类型的值

c# - 无法将类型为 'ASP._Page_Areas_Admin__ViewStart_cshtml' 的对象转换为类型 'System.Web.WebPages.StartPage'

ASP.NET MVC 或 ASP.NET MVC2 RC2 -> RTM

java - java中的超时值超过启动取消azure函数

azure - 无法加载名为 'Diagnostics.' 的导入模块

dependency-injection - Ninject 绑定(bind)所有实现相同接口(interface)的类

c# - 使用 Ninject 在 MVC 3 中注入(inject)属性

c# - 使用 Ninject 加载多个绑定(bind)

c# - HttpPostedFile 返回空值?