Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8446751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:00:14+00:00 2026-06-10T10:00:14+00:00

In IIS 7, I have created a web site using a Nancy project. Then,

  • 0

In IIS 7, I have created a web site using a Nancy project. Then, I added an MVC 2 application to the site using the alias api. I am able to visit defined routes in the Nancy project perfectly. However, when I visit /api, I get the following error:

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

It seems that the MVC 2 application is trying to use the NancyHttpRequestHandler to process the request. I say this because routes that are not defined in the Nancy application display a 404 page.

I have tried several things:

  1. To Web.config of the MVC 2 application, I added the following to the <system.web/> block:

    <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>
    
  2. To Web.config of Nancy application, I added the following to the <system.web/> block:

    <httpHandlers>
      <add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
      <remove verb="*" path="api/*" />
    </httpHandlers>
    
  3. I have also tried toying with the settings in the <system.webServer/> and <system.serviceModel/> blocks in both applications.

How can I get the MVC 2 application to behave properly when it is embedded in the Nancy site in IIS 7? Any guidance would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:00:16+00:00Added an answer on June 10, 2026 at 10:00 am

    You had the right idea — you need to block inheritance of the NancyFx specific configuration sections to the child MVC sites.

    In your root (NancyFx) site, create a <location/> tag with your normal configuration. Your NancyFx web.config structure will look something like below. (I added comments to try to keep you out of trouble if you decide to upgrade your MVC2 site to MVC3.)

    <configuration>
      <configSections/>
      <!-- FYI... configSections cannot be moved into the location tag. If you plan
           to upgrade to MVC3 and use the Razor view engine, those configSection 
           declarations need to live here. If you upgrade to MVC3 and use the Razor 
           view engine, you will need to remove the Razor configSections from the 
           views/web.config files any child MVC3 project. -->
      <system.web /> <!-- site-wide system.web settings -->
      <system.webServer /> <!-- site-wide system.webServer settings -->
    
      <!-- Put the NancyFx specific configuration here -->
      <location path="." inheritInChildApplications="false"> 
      <!-- The inheritInChildApplications attribute is the magic sauce! :) -->
        <connectionStrings /> 
        <!-- If the connectionStrings are shared by the child site, 
             you could move them out to the main configuration. But they 
             cannot exist in both sections of this file. -->
        <appSettings />
        <system.web>
          <httpHandlers>
            <add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
          </httpHandlers>
        </system.web>
        <system.webServer>
          <handlers>
            <add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
          </handlers>
        </system.webServer>
      </location>
    </configuration>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an multi thread application on IIS (ASP.NET MVC), When the threading
I have IIS 7.5 With one web site I added new virtual directory and
I created a brand new project using the default Web Application template and I
I am using IIS 6 on 2003. I have created a HTTP handler dll
I have an HttpModule that I created and am running on IIS 6 using
I have built an MVC 3 application and I have a Web Server 2008
I am developping a web application by using the ASP .NET MVC 3 framework.
I have created the route as described in http://www.asp.net/mvc/tutorials/older-versions/deployment/using-asp-net-mvc-with-different-versions-of-iis-vb ; however, my site still
Solved using this post: Can you convert an ASP.NET MVC Application to a Web
On my previous machine I had IIS6 installed and created a web project using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.