ASP.NET Core Web Api Error for IhttpActionResult2019 Community Moderator ElectionASP.NET Core Web API exception handlingAsp.net Core API with CORS on Service Fabric 100% CPU bottleneckStructuring an ASP.NET Core project to reference .Net Standard librariesReturn file in ASP.Net Core Web APITalking to IdentityServer4 with an Angular SPA application for authentication/authorization receiving a token then talking to Web APIEntity Framework Core with ASP.NET Core Web API and SQL Server (+ Xamarin.Forms)Why doesn't this deadlock in ASP.NET Core Web API?ASP.NET Core (2.1) Web API: Identity and external login providerHow to implement OData Core with async await?Asp .Net Core 2.2 Web Api - Windows authentication from angular app - CORS issue

Why do Australian milk farmers need to protest supermarkets' milk price?

Confusion with the nameplate of an induction motor

Are there situations where a child is permitted to refer to their parent by their first name?

What is the definition of "Natural Selection"?

Counter-example to the existence of left Bousfield localization of combinatorial model category

validation vs test vs training accuracy, which one to compare for claiming overfit?

Replacing Windows 7 security updates with anti-virus?

Is having access to past exams cheating and, if yes, could it be proven just by a good grade?

Is "history" a male-biased word ("his+story")?

Why does Deadpool say "You're welcome, Canada," after shooting Ryan Reynolds in the end credits?

What Happens when Passenger Refuses to Fly Boeing 737 Max?

Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?

Is it true that real estate prices mainly go up?

Format picture and text with TikZ and minipage

When were linguistics departments first established

My story is written in English, but is set in my home country. What language should I use for the dialogue?

What to do when during a meeting client people start to fight (even physically) with each others?

Sword in the Stone story where the sword was held in place by electromagnets

Making a sword in the stone, in a medieval world without magic

Force user to remove USB token

Life insurance that covers only simultaneous/dual deaths

Is all copper pipe pretty much the same?

How to make readers know that my work has used a hidden constraint?

What happens with multiple copies of Humility and Glorious Anthem on the battlefield?



ASP.NET Core Web Api Error for IhttpActionResult



2019 Community Moderator ElectionASP.NET Core Web API exception handlingAsp.net Core API with CORS on Service Fabric 100% CPU bottleneckStructuring an ASP.NET Core project to reference .Net Standard librariesReturn file in ASP.Net Core Web APITalking to IdentityServer4 with an Angular SPA application for authentication/authorization receiving a token then talking to Web APIEntity Framework Core with ASP.NET Core Web API and SQL Server (+ Xamarin.Forms)Why doesn't this deadlock in ASP.NET Core Web API?ASP.NET Core (2.1) Web API: Identity and external login providerHow to implement OData Core with async await?Asp .Net Core 2.2 Web Api - Windows authentication from angular app - CORS issue










0















I am trying to create a new Core Web API app for the first time. I am using Core 2.2



I did some research but did not find the correct answer. Not sure if I am using wrong libraries.



cannot implicitly convert type microsoft.aspnetcore.mvc.okresult to system.web.http.Ihttpactionresult



Here is my Code



using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.AspNetCore.Mvc;

[Microsoft.AspNetCore.Mvc.Route("api/User")]
[ApiController]
public class UserController : ControllerBase

[Microsoft.AspNetCore.Mvc.HttpGet]
public async Task<IHttpActionResult> GetAllUsers()

var users = await this.GetUserAsync();
return this.Ok(users);











share|improve this question

















  • 1





    In addition to the answers below, remove the System.Web dependency. That's going to cause all sorts of issues. ASP.NET Core does not use System.Web so if you see something coming from that namespace, you're doing it wrong.

    – Chris Pratt
    Mar 6 at 18:27















0















I am trying to create a new Core Web API app for the first time. I am using Core 2.2



I did some research but did not find the correct answer. Not sure if I am using wrong libraries.



cannot implicitly convert type microsoft.aspnetcore.mvc.okresult to system.web.http.Ihttpactionresult



Here is my Code



using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.AspNetCore.Mvc;

[Microsoft.AspNetCore.Mvc.Route("api/User")]
[ApiController]
public class UserController : ControllerBase

[Microsoft.AspNetCore.Mvc.HttpGet]
public async Task<IHttpActionResult> GetAllUsers()

var users = await this.GetUserAsync();
return this.Ok(users);











share|improve this question

















  • 1





    In addition to the answers below, remove the System.Web dependency. That's going to cause all sorts of issues. ASP.NET Core does not use System.Web so if you see something coming from that namespace, you're doing it wrong.

    – Chris Pratt
    Mar 6 at 18:27













0












0








0








I am trying to create a new Core Web API app for the first time. I am using Core 2.2



I did some research but did not find the correct answer. Not sure if I am using wrong libraries.



cannot implicitly convert type microsoft.aspnetcore.mvc.okresult to system.web.http.Ihttpactionresult



Here is my Code



using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.AspNetCore.Mvc;

[Microsoft.AspNetCore.Mvc.Route("api/User")]
[ApiController]
public class UserController : ControllerBase

[Microsoft.AspNetCore.Mvc.HttpGet]
public async Task<IHttpActionResult> GetAllUsers()

var users = await this.GetUserAsync();
return this.Ok(users);











share|improve this question














I am trying to create a new Core Web API app for the first time. I am using Core 2.2



I did some research but did not find the correct answer. Not sure if I am using wrong libraries.



cannot implicitly convert type microsoft.aspnetcore.mvc.okresult to system.web.http.Ihttpactionresult



Here is my Code



using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.AspNetCore.Mvc;

[Microsoft.AspNetCore.Mvc.Route("api/User")]
[ApiController]
public class UserController : ControllerBase

[Microsoft.AspNetCore.Mvc.HttpGet]
public async Task<IHttpActionResult> GetAllUsers()

var users = await this.GetUserAsync();
return this.Ok(users);








asp.net-core asp.net-core-webapi






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 6 at 17:41









ChatraChatra

42611140




42611140







  • 1





    In addition to the answers below, remove the System.Web dependency. That's going to cause all sorts of issues. ASP.NET Core does not use System.Web so if you see something coming from that namespace, you're doing it wrong.

    – Chris Pratt
    Mar 6 at 18:27












  • 1





    In addition to the answers below, remove the System.Web dependency. That's going to cause all sorts of issues. ASP.NET Core does not use System.Web so if you see something coming from that namespace, you're doing it wrong.

    – Chris Pratt
    Mar 6 at 18:27







1




1





In addition to the answers below, remove the System.Web dependency. That's going to cause all sorts of issues. ASP.NET Core does not use System.Web so if you see something coming from that namespace, you're doing it wrong.

– Chris Pratt
Mar 6 at 18:27





In addition to the answers below, remove the System.Web dependency. That's going to cause all sorts of issues. ASP.NET Core does not use System.Web so if you see something coming from that namespace, you're doing it wrong.

– Chris Pratt
Mar 6 at 18:27












2 Answers
2






active

oldest

votes


















2














You need to use IActionResult, not IHttpActionResult.



The IHttpActionResult interface does not exist in Core, it's used in older Web API projects.






share|improve this answer
































    2














    [HttpGet]
    public async Task<IActionResult> GetAllUsers()

    var users = await this.GetUserAsync()
    return Ok(users);



    Try changing the type to IActionResult.
    According to Microsoft docs: the following components don't exist in ASP.NET Core:



    IHttpActionResult interface



    And I don't believe you need this.Ok, it should be fine using just Ok.






    share|improve this answer






















      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55029185%2fasp-net-core-web-api-error-for-ihttpactionresult%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      You need to use IActionResult, not IHttpActionResult.



      The IHttpActionResult interface does not exist in Core, it's used in older Web API projects.






      share|improve this answer





























        2














        You need to use IActionResult, not IHttpActionResult.



        The IHttpActionResult interface does not exist in Core, it's used in older Web API projects.






        share|improve this answer



























          2












          2








          2







          You need to use IActionResult, not IHttpActionResult.



          The IHttpActionResult interface does not exist in Core, it's used in older Web API projects.






          share|improve this answer















          You need to use IActionResult, not IHttpActionResult.



          The IHttpActionResult interface does not exist in Core, it's used in older Web API projects.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 6 at 21:40

























          answered Mar 6 at 17:46









          juunasjuunas

          23.1k35082




          23.1k35082























              2














              [HttpGet]
              public async Task<IActionResult> GetAllUsers()

              var users = await this.GetUserAsync()
              return Ok(users);



              Try changing the type to IActionResult.
              According to Microsoft docs: the following components don't exist in ASP.NET Core:



              IHttpActionResult interface



              And I don't believe you need this.Ok, it should be fine using just Ok.






              share|improve this answer



























                2














                [HttpGet]
                public async Task<IActionResult> GetAllUsers()

                var users = await this.GetUserAsync()
                return Ok(users);



                Try changing the type to IActionResult.
                According to Microsoft docs: the following components don't exist in ASP.NET Core:



                IHttpActionResult interface



                And I don't believe you need this.Ok, it should be fine using just Ok.






                share|improve this answer

























                  2












                  2








                  2







                  [HttpGet]
                  public async Task<IActionResult> GetAllUsers()

                  var users = await this.GetUserAsync()
                  return Ok(users);



                  Try changing the type to IActionResult.
                  According to Microsoft docs: the following components don't exist in ASP.NET Core:



                  IHttpActionResult interface



                  And I don't believe you need this.Ok, it should be fine using just Ok.






                  share|improve this answer













                  [HttpGet]
                  public async Task<IActionResult> GetAllUsers()

                  var users = await this.GetUserAsync()
                  return Ok(users);



                  Try changing the type to IActionResult.
                  According to Microsoft docs: the following components don't exist in ASP.NET Core:



                  IHttpActionResult interface



                  And I don't believe you need this.Ok, it should be fine using just Ok.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 6 at 17:54









                  porkchop.12porkchop.12

                  3113




                  3113



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55029185%2fasp-net-core-web-api-error-for-ihttpactionresult%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

                      Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

                      Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved