Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have multiple web rest api based of DotNet Core 2.2 but I want to develop WCF service in existing DotNet Core 2.2 project which have already rest api's.

If I deployed different-2 hosting server, then maintenance will be increased. So I want to all different project in one solution of visual studio 2019.

So please suggest what will be do.

What I have tried:

    [Route("api/[controller]/[action]")]
    public class EmployeeListController : ControllerBase
    {
        clsLogin objBO = new clsLogin();

        public async Task<IActionResult> GetEmployeeList(Int64? TenantId)
        {
            try
            {
                clsLogin cls = new clsLogin();
                LstEmployee objresp = new LstEmployee();
                objresp.EmployeeMaster = new List<EmployeeMaster>();
                clsLoginCredentials oLoginCredentials = cls.GetWebApiTokenDetail(this.HttpContext);

                //Creating Client object of Service Reference
                ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
                var result1 = await client.GetEmployeeDataAsync(Convert.ToInt32(TenantId));

                var arr = result1;

                for (int i = 0; i < arr.Count(); i++)
                {
                    EmployeeMaster obj = new EmployeeMaster();
                    obj.empM_LegEnt_Id = Convert.ToInt64(arr[i].empM_LegEnt_Id);
                    obj.empM_empId = arr[i].empM_empId;
                    obj.empM_UID = Convert.ToString(arr[i].empM_UID);
                    

                    objresp.EmployeeMaster.Add(obj);
                }

                if (objresp.EmployeeMaster.Count > 0)
                {
                    objresp.ResponseCode = ApiResponseCode.RecordFoundCode;
                    objresp.ResponseMessage = ApiResponseCode.RecordFoundMessage;
                    objresp.ResponseType = ApiResponseCode.RecordFoundType;
                    return Ok(objresp);
                }
                return NotFound();
            }
            catch (Exception ex)
            {

                throw;
            }
        }
}
Posted
Updated 9-Jan-20 8:44am
v2

1 solution

.NET Core doesn't really support WCF. There's a library to support calling WCF services[^], and a third-party library[^] for WCF server support which is incomplete and not yet ready for production. But Scott Hunter has specifically stated that WCF won't be added to .NET Core:
This means we will not be adding ASP.NET Web Forms, WCF, Windows Workflow, .NET Remoting and/or the various other smaller APIs to .NET Core.

Depending on your requirements, you might want to consider gRPC[^] instead:
Introduction to gRPC on .NET Core | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900