UWP app as wcf server? - wcf

What I observed is:
The System.ServiceModel.ServiceHost class is not available in .NET Core for UWP;
Duplex channel is PlatformNotSupportedException that doesn't support wcf callback.
So I wonder, UWP apps are designed to only work as WCF client? Isn't it possible to host a wcf service in a UWP app to make it like a server?

UWP Application worked in with limited folder access and limited capabilities.
To Host WCF Service it needs to act as web server. It does not have that capability included.
Below are the capabilities supported.
https://learn.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations

Related

Xamarin Forms and WCF NetTcpBinding with duplex

I have developed a self-hosted WPF server application and a client WPF application which communicated with WCF NetTcpBinding with duplex like common connected TCP socket communication scenario.
Now, I will develop a mobile client which communicates existing self-hosted WPF server application.
I know that old Xamarin does not support NetTcpBinding.
Does the latest Xamarin Forms (or Xamarin.Android, Xamarin.iOS) support NetTcpBinding with duplex? It seems that .NET Core 3.0 supports NetTcpBinding, but I have no idea for Xamarin.
If Xamarin does not support WCF NetTcpBinding, is self-hosted SignalR a good alternative for full duplex connected communication?
As far as I know, Dotnet Core3.0 SDK supports the Nettcpbinding and I can generate the client proxy class properly by using Microsoft WCF web service reference provider. Thereby it supports duplex communication too.
I didn’t have much exposure to Xamarin. If the project based on the Core 3.0 SDK. I think it should be capable of supporting Nettcpbinding.
Feel free to let me know if there is anything I can help with.

How do use WCF to communicate between an Application and a Windows Service?

I've gone through some tutorials on creating a WCF service. I'm using Visual Studio 2012. I got a very simple WCF Service Library (vb.net) and Windows Application (vb.net) communicating via WCF. That's a start.
However, my project requires I do the following:
My Windows Service - This is already an application that has it's tasks.
My Application - This is an application that is already developed as well.
I need the service to talk to the application. The service will need to send the following information to the windows application:
Status Updates
Metric Information (mostly integers for counts)
I need the application to send information to the service. It would need to send:
Reload Configuration command
Should be relatively simple, but I've never worked with WCF until today. So I have some questions...
Do I need to re-work my current windows service into a WCF Service?
Since it won't be in IIS, do I also create a WCF Service Library or do I roll this into the windows service somehow?
What is the best way to set up the different types of communication? (i.e., sending over specific metrics and reload commands)
Probably the main question is what components, in addition to my current windows service and application, will I need to make this work?
I hope that was clear :( I think I'm confusing it all... but I hope not
Your Windows service can host the WCF service. Similarly, if you want, your application can host a WCF service. The application could talk to the WCF service in the Windows Service, and the Windows Service's WCF could talk to the one in the application. Depending on the nature of the communication, you could also just use a callback channel to permit the Windows Service's WCF to call back to the application.
I suppose you should configure your WCF windows service to use named pipes. If your windows service is already built then the easiest way to do it would be to build another one as a WCF windows service and wrap the already existing functionality.
Hope I helped!

WCF Web socket client also need to run on windows 8

I am new to WCF web socket and I am trying to implement duplex service using web socket. I have implemented the wcf web socket service using the following example and it works fine.
http://msdn.microsoft.com/en-us/library/hh977020.aspx
I know the minimum requirement for WCF service for web socket is windows 8 and .net framework 4.5. So I have hosted my service on windows server 2012 server machine.
Then I have written WCF web socket client to access the service and my client is windows
form applications runs on windows 7. I got the following error.
“This platform does not support client side WebSockets natively.
Support for client side WebSockets can be enabled on this platform by
providing an implementation of
System.ServiceModel.Channels.ClientWebSocketFactory.”
Does web service client also need to have windows 8? If it needs are there any third party libraries to access WCF web socket service.
Really appreciate your reply.
You will need win8 or 2012server to be able to use the Microsoft WebSocket namespace in your WCF. You could also take a look at SignalR that will fallback to other techniques when WebSockets is not available.
You can also use XSockets.NET that will run websockets on .NET 4 (so there is no need for win8 or 2012server).
You also have SuperWebSocket and Fleck as options of .NET 4.
Edit: Added sample with WebSockets from WCF .NET 4 here https://github.com/XSockets/XVA/tree/master/XVA-07-02-BoostWCF/Any%20OS

create window service and call wcf service

In my Application we used Android for native application and wcf service for maintain backend . Requirement is to send notification to tablet periodically. I think to use window service and call wcf service.And on my server only .Net framework is there. But i don't know how to create windows service and call wcf service.
My requirement is to call wcf service on the base of date which stored in database. Example if 30/04/2013 is stored than wcf service will call automatically on 30/04/2013
There are many tutorial about to consume a "WCF" web service on an android device. Here's one that I find well documented.
Comsuming WCF Services With Android
WCF and Android Part I
WCF and Android: Part II
Comsuming WCF Services With Android
I hope this help you

What is the difference between a WCF Service Application and a WCF Service Library?

I am developing a WCF web service and I used the WCF Service Application template to do that.
Does creating a "WCF Service Application" fulfill this requirement?
What are the advantage of creating a WCF Service Library over a WCF Service Application?
A service application includes a website host already setup for you. A service library is a library of services that a host can reference and startup.
If you start with a service library (recommended) you can then choose any host you wish (a windows service, IIS/ASP.NET, or even a console application) and you'd just reference your library from your new host. Choosing a Service Application limits your host to just IIS/ASP.NET (though this might be ok for your purposes, but will limit the protocols you can use).
Edit: Changes in IIS since I wrote this allow for a wider variety of protocols on ASP.NET activated services, so choosing a service application is much less limiting than before.
If all you have is the one project I see only added complexity if you separate for the heck of it. I used a library when I had some particular use cases where I had to host in both a windows service and in IIS.
For IIS you you can move the classes and interfaces to a library but keep your .SVC files in the web project. You must edit the .SVC files to point to the properly qualified classes.