简体   繁体   中英

C# console with MVC3 - Call MVC action method from console application

I am working on one C# console application which create List collection of class object now I want to send that object to one mvc3 application (another project) action method. But when i add reference of mvc3 application to my console application it show some warning and error that are as follows :

Warning 1 The referenced assembly "MVC_POP3" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. Console_Gmail_POP3

Error 4 The type or namespace name 'MVC_POP3' could not be found (are you missing a using directive or an assembly reference?) D:\\Users\\Rajendra\\TASKs\\Console_Gmail_POP3\\Console_Gmail_POP3\\Program.cs 13 7 Console_Gmail_POP3

So is it possible that i call mvc action method from my console application ?

Please guide me regarding this....

Change the .NET framework of your console application from client profile to full .NET 4

Steps:

  • Right click on your console project, select Properties
  • Application > Target framework
  • Select .NET Framework 4 instead of .NET Framework 4 Client Profile

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM