none
Alternative approach for .net remoting in .net core RRS feed

  • Question

  • Hi Team,

    we are invoking the methods from c layer to C# layer using .net remoting.

    now we are switching to .net core. I read .net remoting is not supported in .net core.

    How i can cal C# methods from c layer.

    Can you please help me with best approach using inter process communication.

    (e.g: NamedPipes/gRPC/Socket/TCP).

    Please help me with code sample.

    Thanks, 

    Ravi

    Wednesday, July 24, 2019 5:29 AM

All replies

  • You can put the C# code into a Core classlib project. You can create an ASP.NET WebAPI that has reference to the C# classlib project.

    https://github.com/reagent/http

    However, I don't know if the particular c HTTP client uses the HTTP verbs the WebAPI expects, which is a Restful service that is using the Json format as the default data exchange.

    https://www.restapitutorial.com/lessons/httpmethods.html

    You may also what to look into Core 3.0 that works with Windows desktop solutions and that version may have the protocols you are looking to use. You would need to be using VS2019 Community and Core 3.0  preview version in order to use Windows desktop solutions at this time.

    Wednesday, July 24, 2019 7:11 AM
  • Thank you for your response.

    The application(server1 & server2) are developed for linux and windows environment.

    there are two process, server1 is developed by c language and another server2 is developed by .net.

    how can i call a method available in server2 (developed by .net core) from the server1 (developed by c language).

    Please help with solution.

    Thanks in advance.


    • Edited by RaviRaju Friday, July 26, 2019 2:57 PM
    Friday, July 26, 2019 2:54 PM
  • Thank you for the response.

    I have tried Named pipes approach in linux environment.

    In c layer i used to create Named pipes (FIFO) as a client , in .net core used Named pipes as server.

    But i could not succeed.

    My requirement is call the C# functions from C layer.

    Please help me.

    Regards,

    ravi.

    Tuesday, July 30, 2019 6:30 AM
  • Welcome,

    can you try the method in this article:

    http://tigerang.blogspot.com/2008/09/reverse-pinvoke.html

    Best regards;

    Tuesday, July 30, 2019 2:54 PM
  • Hi RaviRaju, 

    Thank you for posting here.

    For your question, you want to call C# methods from C.

    I have found a related reference.

    Calling C# from C

    Hope it can help you.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 31, 2019 2:23 AM
    Moderator
  • Thank you so much for your help. But my goal is different.

    The above approached can call C# methods from C. but in my case both are different processes (.exe).

    There are two process (1 - developed by c language, 2-developed by C#). This two process developed for windows environment.

    The communication between the c layer to C# layer we used .net remoting.

    Now we are trying to support for linux.

    we are migrating the C# projects (2nd process) to .net core which supports multiple platforms.

    Now the problem is .net core does not support remoting concept.

    my goal is to communicate two process either by Named Pipes/Memory mapped files/gRPC/Socket or any other better approach as a communication channel.

    Please help me with best approach to communicate between two process and object exchange.

    thanks in advance.


    • Edited by RaviRaju Wednesday, July 31, 2019 9:34 AM
    Wednesday, July 31, 2019 9:31 AM
  • Hi RaviRaju,

    Thanks for your feedback,

    Based on your description, I have a question to confirm with you.

    >>The communication between the c layer to C# layer we used .net remoting

    What does 'remoting' mean? Are two processes in the different equipments?

    We are waiting for your update.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 1, 2019 9:24 AM
    Moderator
  • Thank you so much for response. Here is my comments.

    >> What does 'remoting' mean? Are two processes in the different equipments?

    .net remoting concept for marshaling object and tcp is the connection to communicate between c process and C# process .

    the two process are in same PC. My environment is Ubuntu using .net core as C# development.

    Please help me some approach and code snippet if possible.

    Thanks,

    Ravi


    • Edited by RaviRaju Tuesday, August 6, 2019 1:32 PM
    Tuesday, August 6, 2019 1:31 PM
  • Hi RaviRaju,

    Thanks for your feedback.

    I note that your environment is Ubuntu, considering our test environment is Windows and your topic is call c# from c, so I suggest you ask your question in other C forums for better help.

    The C# forum is for C# related question, we discuss and ask the C# programming language, IDE, libraries, samples and tools here, and we are glad to deal with problems about calling other languages from C#.

    Thank you for your understanding and support.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 7, 2019 9:09 AM
    Moderator
  • Thank you.
    Wednesday, August 7, 2019 10:02 AM