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 8944113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:57:13+00:00 2026-06-15T11:57:13+00:00

I have a Windsor ASP.NET MVC WebAPI project setup like: http://nikosbaxevanis.com/2012/07/16/using-the-web-api-dependency-resolver-with-castle-windsor-scoped-lifetime/ Everything works fine

  • 0

I have a Windsor ASP.NET MVC WebAPI project setup like:

http://nikosbaxevanis.com/2012/07/16/using-the-web-api-dependency-resolver-with-castle-windsor-scoped-lifetime/

Everything works fine when my controller returns an OK status. However, if I try to send an error status, like not NotFound, then I get the following error:

Castle.MicroKernel.Lifestyle.Scoped.CallContextLifetimeScope+SerializationReference,Castle.Windsor, Version=3.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc

Here is my controller method:

    // GET api/values
    public IEnumerable<string> Get()
    {
        bool valid = ...;
        if (valid)
            return new[] {"valid"};

        HttpResponseMessage resp = new HttpResponseMessage(HttpStatusCode.NotFound);
        resp.Content = new StringContent("My custom message");
        throw new HttpResponseException(resp);
    }

Notice, if I comment out the line with “resp.Content”, then everything works fine.

  • 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-15T11:57:14+00:00Added an answer on June 15, 2026 at 11:57 am
    throw Request.CreateErrorResponse(HttpStatusCode.NotFound, "My custom message");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following setup, I have three assemblies. Web (ASP.NET MVC 3.0 RC1) Models
I've setup Castle Windsor in my ASP.NET Mvc 3 project and added the following
I have about 4-6 years .NET experience. Primarly using ASP.NET MVC/Nhibernate/Castle Windsor/MSpec/etc in visual
I am using NServiceBus 3.2.7, Castle Windsor 3.1, and ASP.Net MVC 4. I am
I have created an ASP.NET MVC application and am trying to use Castle Windsor
Using Castle.Windsor in ASP.NET MVC (3.0) is there any way I can appropriately handle
in asp.net-mvc I have the Windsor Controller Factory that injects all the dependencies into
I have decided to use ASP.NET MVC for a website project and want to
I'm using ASP.NET MVC 3 and have my custom model binder. public class NewsModelBinder
I have an ASP .Net MVC 3.0 web application hosted on IIS and I

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.