添加到南希的网站在IIS 7中,我创建了使用南希项目网站。然后,我添加了一个MVC 2应用程序使用别名api
网站。我能够完美地访问Nancy项目中定义的路线。然而,当我访问/api
,我得到以下错误:的MVC 2应用程序在IIS 7
Could not load type 'Nancy.Hosting.Aspnet.NancyHttpRequestHandler'.
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: Could not load type 'Nancy.Hosting.Aspnet.NancyHttpRequestHandler'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Could not load type 'Nancy.Hosting.Aspnet.NancyHttpRequestHandler'.]
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +11588073
System.Web.Configuration.HandlerFactoryCache.GetTypeWithAssert(String type) +47
System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) +18
System.Web.Configuration.HandlerFactoryCache..ctor(String type) +27
System.Web.HttpApplication.GetFactory(String type) +95
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +352
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
看来,MVC 2应用程序试图使用NancyHttpRequestHandler来处理请求。我这样说是因为Nancy应用程序中未定义的路由显示404页面。
我已经试过几件事情:
到MVC 2应用程序的
Web.config
,我添加了以下到<system.web/>
块:<httpHandlers> <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </httpHandlers>
南锡应用
Web.config
,我加下面对<system.web/>
块:<httpHandlers> <add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" /> <remove verb="*" path="api/*" /> </httpHandlers>
我也试图与这两个应用程序的
<system.webServer/>
和<system.serviceModel/>
块的设置玩弄。
如何在MVC 2应用程序嵌入到IIS 7中的Nancy站点时正常运行?任何指导将不胜感激。
好极了!只是测试了这一点,它就像一个魅力。如果我能说服我的团队从过去两周南希迁移我们所有的工作MVC3。 :) 感谢您的信息。干杯! – 2012-09-07 18:24:24