Exposing WPF or WinForms application as API or service - c#

I have WPF application and i have to implement it with some other application on same PC.
It is request that my app must be accesed with api or service, and also to hide GUI totaly.
So i need advice on api or service for my application, should i create windows service of WCF application, so other application (JAVA application) can call my app and get returned string.
Any suggestion on this case is more then welcome!

If you want to have WPF application, you can host a WCF service within your WPF application. Read for example: Running a WCF listener in a WPF application

I would do both - a WCF service hosted within a windows service, you can throw away WPF completely.
The WCF's BasicHTTPBinding works well with Java's javax.xml.ws.Service.

Related

How to create a windows service with an IIS hosted WCF service embedded

Our project need a new component. 1. It need to communicate with non-WCF components. I would like to host WCF service in IIS + WAS, which is more stable than self-hosted WCF service. 2. Meanwhile, there are many work loads as well as queuing/cache needed for the new component, I want it works as a long-running window service. To be a summary, can we have an IIS hosted WCF service as a part of a window service? Would you please note that I don't want to compare hosting via IIS vs windows service. Thanks.

Desktop WPF Application with remote Web UI like utorrent

I developed a windows desktop application using vb.net. I want to use the application with windows headless server. It will be easier if it has a web interface like utorrent. My initial approach was to write the current state to a text file (JSON/XML) and then read the file from the web interface. but it leads to too much read/write operation. is their any better approach? how about using REST API calls?
You could run a WCF web service from your WPF application, see https://learn.microsoft.com/en-us/dotnet/framework/wcf/how-to-host-a-wcf-service-in-a-managed-application
That would expose an API that you could run a client against (eg. using Javascript on a web page).

Consume WCF Service in windows 8.1 mobile app developement

I am creating windows 8.1 mobile application where i want to consume WCF service.
I know how to call Webservice from windows 8.1,simply we call the url of webservice.
for ex: http://192.168.0.102/MobilApp/SrvOMM.asmx/FunCheckLogin?username=abc&password=abc
above url we call through http client and it call and return the result same thing I want to call in WCF service.
I have created WCF service and checked it in Test Client its working fine.
when i am creating url as we create for web service and hitting it, it returns an error.
I am unaware of WCF web.config settings like endpoints,service behaviour and etc. if is there anything we need to mention in configuration file please let me know.
Just wanted step by step process to consume WCF service in windows 8.1 mobile app.
Thanks in advance
Consuming a WCF service in windows 8/8.1 can be done. See this blog:
http://blogs.msdn.com/b/piyushjo/archive/2011/09/22/wcf-in-win8-metro-styled-apps-absolutely-supported.aspx

Call a function of windows application from wcf service function

Can I Call a function of windows application from wcf service function,The main purpose of the whole application is: Windows service will detect some event and will show something on windows form application for recognizing the event by the user. Windows service and windows form application should communicate with each other by WCF service.
Thanks in Advance.
Normally web-services are developed to be called by the clients.
To send messages to client, which is the Windows Forms application in your case can be done
Long Polling or
WCF TCP/IP bindings.

Communication between a desktop application and a web application

I have a desktop and web application connected to same database.
Which is the most preferred method to make them communicate with each other?
You should use SOA and then both your desktop app and web app should communicate with the Service.
And the Service will be responsible for communicating with the database.

Categories