I don't exactly know, how to ask this question.
I have 3 computers in my local network. On first computer I have installed windows service which hosts WCF Services (binding netTcp). So my address is "net.tcp://localhost:8523/Sms" for example.
Now, I would like to use that service from other two computers. I don't know If I have access to that WCF service - I don't how to check it.
And also I don't know, How to create a WCF client, that will update service reference programmatically?
Related
I have one wcf service which acts as server and client, i want to install that in different systems and communicate between them, can you please give me an example how to that,
I Have created one wcf service which have both client and server API and installed in two computers, i have created the channel factory object in client side to contact the server methods.
channel has created but i am not able to call the method, it is giving the object reference not set to an instance of an object error.
I have a server physically located in the US. The OS is Windows Server 2008 R2 SP1.
I create a WCF service and host it in IIS on the server.
Now, while I'm physically in Germany, I want to write a WCF client to the WCF service. First of all, I need to create a WCF client proxy.
All the tutorials I've seen imply that the WCF service and WCF client are located on the same machine. I.e., the tutorials use "localhost" everywhere. In my case it doesn't work.
I know the IP of my server but I don't know what settings should be done to allow any programmer to use the WCF service. I guess it requires special customization of the endpoint at the WCF service and some settings at the IIS to make the WCF accessible by anybody.
Can you please give a piece of advice in this regard?
Thanks for any suggestions!
Two approaches are available :
Create a service reference using the add reference , enter your service address should be something like : http://IpAdress/service.svc , or if you have your wsdl file on your local disk , just enter your wsdl file location in the add service address bar. This will generate the proxy class.
If you have the service contract(interface) just do it programatically using ChannelFactory , you must know your binding and endpoint address as well.
If have any questions you're welcome
I need to call a WCF service that is behind a DMZ:
WEBDMZ .. LANDMZ
------------- ------------
ClientServer => WCF service
As there is a firewall between the two it's not possible for the Client to connect to the WCF service. So I need the WCF service to connect to the client and "listen" to connections or create a tunnel somehow.
I feel it must be a very common problem but I haven't been able to find a proper solution yet. And no it's not possible to open a port. The connection have to be initiated by the WCF.
The client is a server and can easily host any MSMQ or other service.
It seems like this problem can also be referred to as "reverse proxy" or "reverse tunnel".
Solution ideas:
MSMQ hosted by Client (but I'm afraid if it would just simply be polling all the time and creating a network overhead).
A reverse tunnel/proxy?
WCF Duplex?
I'm looking for the simplest solution, preferably in C# and without 3rd party software. Perhaps there is a WCF configuration that allows for reverse calls?
With .Net version 4, you can look at WCF Routing service at here. Or you can build a routing service by yourself following example from Michele Leroux. Here is the link.
EDIT:
You can build a routing service, put it at WEBDMZ server, it will contains list of endpoint wcf service put at DMZ server. At here it will take role as a service server as well as client connect to services at DMZ server. You also can build a discovery service to configure these endpoints automatically.
I have a WCF service which serves as a remote file/folder browser. We also plan on having a Windows Service that will serve as 3 functions.
Windows Service will start the WCF service so it can do its job (part of the same project)
Windows Service will Upload some data to an SQL server every few minutes based on a timer + many other methods like this
WCF will Receive a request to run a method as requested by an asp.net client via WCF and then ask the windows service to run a method and return a result to WCF and pass back the result to ASP.net.
Item 3 is the problem. How is a windows service supposed to talk to a WCF Service (and Vice-Versa) service that both run on the same machine and are essentially the same application running as one. is it over WCF again?
Possibly i am going about this all wrong. Hopefully someone may be able to help
thanks
Damo
WCF Services may be hosted within Windows Services. See http://msdn.microsoft.com/en-us/library/ms750530.aspx. The specific example they give is for a console application, but the same concept applies.
When self hosting, you can eiter specifiy a type that will be instantiated when a client connects to the service , or you pass the instance that your clients will use when they hit the service. In either case, you can instantiate the same class or access the instance passed to ServiceHost to call methods on the service, though they would not go through the WCF pipeline. The WCF Service class can get a reference to the Windows Service class and access methods on that to allow for callbacks to occur without another trip through the WCF stack.
Alternatively, if you do not wish to self-host or your application uses WCF specific calls in the service, you can create a wcf client in the service in the same way as you would on a desktop application. Simply add a service reference as normal and use callbacks to hop back to the Windows Service code.
The first answer is correct.
I'll suggest also consider the following: if you don't have the windows service to host that wcf service, then go on with exposing new one in there. There are other options as well, but those are going lower level, so WCF is the easies and safest option. The same time - its quite elegant solution.
I am new to WCF (Just a day or 2). I am planning to make an application having Client/Server
WCF Service (On Server hosted as windows service):
Will invoke some commands using (Process.Start())
Will send some information from my database
Questions:
What WCF binding should I use? WsDualhttp or netTCP (Please elaborate if you can)
Does WCF works with SqlServer + EF 4.1
Server UI:
This will primarily will be used to
Start ot stop the above service
Change Address (localhost to [My Ip address]) and Port
Show status of service (Running or dead)
Questions:
How can I Change the address and port of my WCF service from this UI (it will be a different project and hence different config file).
Client App:
Used to issue commands to WCF service.
Get to know if the service is running or dead.
Receive status messages for task completion or faults.
Also, can the windows installer be combined to install ServerUI + WCF Service + Windows service?
WCF Service
Here are a couple links on choosing the right binding. Based on the scenario you're describing, I'd go with the netTCP.
C# - WCF - inter-process communication
Choosing the right WCF binding
WCF and SQL Server are independent of each other, so I wouldn't expect any problems using the Windows service to interact with your database.
I'd suggest reading up on how to start a process from a Windows service.
Server UI
I would suggest hosting another WCF service in your Windows service for interacting with your Server UI. You can use the netNamedPipeBinding since this communication channel will always be local, i.e., on the same box. So your Windows service will host two WCF services - one for the external communication with the client and one for the local communication with the configuration UI.
Installer
Yes, the Windows installer can be used, but that might be overkill for what you're describing. Of the Server UI, WCF Service, and Windows service, the only one that absolutely requires installation is the Windows service. The others could theoretically run simply by copying the assemblies to the target system. You might consider having the Windows service install itself via command line. That way you could get away with a self-extracting executable using software like WinZip. This might be less heavyweight than a formal install. If you go this route, have a look at the step-by-step here.
Ha a look at WCF duplex services:
http://msdn.microsoft.com/en-us/library/ms731064.aspx
Why do you want to have a interface to an windows service? And if you have access to IIS7 and WAS, I would recommend to use it instead of self-hosting in windows service.
Here is a good starting point for WCF Configuration Management:
http://msdn.microsoft.com/en-us/library/ff650534.aspx
Yes, you can use windows installer.
Cheers
--Jocke