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

  • Home
  • SEARCH
  • 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 8856379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:20:39+00:00 2026-06-14T14:20:39+00:00

I am a WCF dev, new to MVC. Trying to integrate my WCF API

  • 0

I am a WCF dev, new to MVC. Trying to integrate my WCF API as ApiControllers into an MVC application (still big question if it’s a worthy effort).

I have this request from a jQuery plugin:

 POST http://localhost:18698/Api/Public/DoAction HTTP/1.1 
 ....
 Content-Type: application/json; charset=UTF-8 Accept:
 application/json, text/javascript, */*; q=0.01

 {"myParam":"test"}

My controller looks like this:

public class PublicController : ApiController
{
    [HttpPost]
    public string DoAction(string myParam)
    {
        return "Test";
    }
} 

And, the routing piece looks like this:

    config.Routes.MapHttpRoute(
        name: "PublicApi",
        routeTemplate: "api/{controller}/{action}"
    );

I am getting this error:

{
    "Message": "No HTTP resource was found that matches the request URI 'http://localhost:18698/Api/Public/DoAction'.",
    "MessageDetail": "No action was found on the controller 'Public' that matches the request."
}

Methods that don’t accept any JSON parameters work fine, but the ones that accept JSON parameters don’t work. I have to be able to pass complex JSON to the methods. In WCF, translation from JSON to objects was handled for me by WCF.

Do you know why I am getting this error? Would I be able to pass/receive complex JSON as seamlessly in MVC as I did in WCF?

  • 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-14T14:20:40+00:00Added an answer on June 14, 2026 at 2:20 pm

    If you examine the JSON you were sending {"myParam":"test"} then you will see what Darin points out i.e. you need a Model to contain your property e.g. run {“myParam”:”test”} into the following tool: http://json2csharp.com/ and you get:

    public class RootObject
    {
        public string myParam { get; set; }
    }
    

    Your previous method signature with the simple type of string would have been treated by WebApi as a UrlParameter by default (the same as public string DoAction([FromUri]string myFoo)). You can prove this as leaving you code as is this url should work:

    http://localhost:50381/Api/Public/DoAction?myParam=something
    

    The body serialiser using JSON.NET won’t be able to parse a simple .NET type on it’s own and therefore you need to create a simple Model to host it on. This will then use the from body binder public string DoAction([FromBody]RootObject myFoo)

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

Sidebar

Related Questions

I was trying to integrate my Web application with two WCF services provided with
I'm currently trying to get my head around WCF services for an ASP.NET dev
I'm trying to write an application which gets the WCF address and generated a
I have a WCF service which works on my dev machine running IIS 7,
I'm running a WCF service locally on my dev box, and my tests check
I'm writing a WPF test application against a WCF REST service running on Azure
I'm working with a .NET dev team who are trying to interface with a
I'm using WCF Web API to create a self-hosted/InProcess REST Service (HttpServiceHost) that the
I have a service reference on my local dev environment to a WCF service
I have a WCF service and a Web application. Web application makes calls to

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.