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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:29:37+00:00 2026-05-28T17:29:37+00:00

I’m building a web api using WCF web api preview 6, currently I’m stuck

  • 0

I’m building a web api using WCF web api preview 6, currently I’m stuck with a little problem. I would like to have an operation handler to inject an IPrincipal to the operation in order to determine which user is making the request. I already have that Operation Handler and is already configured. But I noticed that when I decorate the operation with the WebInvoke attribute and simultaneously the operation receives an IPrincipal and other domain object, the system throws an exception telling me:

The HttpOperationHandlerFactory is unable to determine the input parameter that should be associated with the request message content for service operation ‘NameOfTheOperation’. If the operation does not expect content in the request message use the HTTP GET method with the operation. Otherwise, ensure that one input parameter either has it’s IsContentParameter property set to ‘True’ or is a type that is assignable to one of the following: HttpContent, ObjectContent1, HttpRequestMessage or HttpRequestMessage1.

I do not know what is happening here. To give you some background I’ll post some of my code to let you know how am I doing things.

The operation:

[WebInvoke(UriTemplate = "", Method = "POST")]
    [Authorization(Roles = "")]
    public HttpResponseMessage<dto.Diagnostic> RegisterDiagnostic(dto.Diagnostic diagnostic, IPrincipal principal)
    {
       ......
    }

WCF web api knows when to inject the IPrincipal because I decorate the operation with a custom Authorization attribute.

The configuration in the Global file:

var config = new WebApiConfiguration() {EnableTestClient = true};
        config.RegisterOAuthHanlder(); //this is an extension method
        routes.SetDefaultHttpConfiguration(config);

        routes.MapServiceRoute<MeasurementResource>("Measurement");
        routes.MapServiceRoute<DiagnosticResource>("Diagnostic");

Then the RegisterOAuthHandler method adds an operation handler to the operation if it’s been decorated with the custom authorization attibute. this is how it looks:

public static WebApiConfiguration RegisterOAuthHanlder(this WebApiConfiguration conf)
    {
        conf.AddRequestHandlers((coll, ep, desc) =>
        {
            var authorizeAttribute = desc.Attributes.OfType<AuthorizationAttribute>().FirstOrDefault();
            if (authorizeAttribute != null)
            {
                coll.Add(new OAuthOperationHandler(authorizeAttribute));
            }
        });
        return conf;
    }

    public static WebApiConfiguration AddRequestHandlers(
       this WebApiConfiguration conf,
       Action<Collection<HttpOperationHandler>, ServiceEndpoint, HttpOperationDescription> requestHandlerDelegate)
    {
        var old = conf.RequestHandlers;
        conf.RequestHandlers = old == null ? requestHandlerDelegate : (coll, ep, desc) =>
        {
            old(coll, ep, desc);
        };
        return conf;
    }

Can somebody help me with this? Thank you in advanced!

  • 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-05-28T17:29:38+00:00Added an answer on May 28, 2026 at 5:29 pm

    Try wrapping your Diagnostic param in ObjectContent i.e. ObjectContent<Diagnostic>. Then you will use the ReadAs() method to pull out the object.

    It should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
I am currently running into a problem where an element is coming back from
We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

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.