I have a program that is a WCF service which connects to third-party WCF service via a proxy server. What I need to specify in app.config to use custom user credentials to this proxy?
Related
I have created a WCF service and hosted it in console application. I have 2 client applications which will communicate with that WCF service, now I want to restrict 3 clients to connect to this WCF service.
Is there any way to reject the connection at server side for 3rd client?
Or is there any way server can validate the connection before establishing with
client?
Server side code
Uri httpBaseAddress = new Uri("net.pipe://localhost/ServiceHost/ServiceHost");
studentServiceHost.AddServiceEndpoint(typeof(StudentService.IStudentService), binding, httpBaseAddress);
studentServiceHost.Open()
If you want to stop 3 Clients from Connection to the service at the same time you can use the maxConnections attribute of the binding, setting it to 2.
If you only want specific Clients to Access Your service. Then you need to set up authentication, see: WCF self hosting require authentication
I'm running a Self-Hosted WCF Service (SSL).
I've seen that other people use netsh to do a namespace
reservation for their Self-Hosted WCF by doing something like that:
netsh http add urlacl url=https://+:80/MyUri user=DOMAIN\user
My webservice works without that Namespace Reservation. So is there any
reason to do that? Am I missing something? Why would I do that namespace reservation?
MSDN: Configuring HTTP and HTTPS
Because you're running the code as an administrative user. Any restricted user won't be able to host an HTTP server on port 80, or any port for that matter, without having the URL registered to their account.
See Why won't my Windows Service that is hosting a WCF Service run under LocalService or NetworkService accounts, WCF Service Access right: No access rights to this namespace.
I have created a WCF service which is hosted on a windows service over NetNamedPipeBinding protocol.Now I want to provide security to this service, as in users with username and passwords known only should access this service.So how do I provide a method level authentication to users to access this service?
NetNamedPipe binding doesn't support message level security out of the box. That would require custom binding. NetNamedPipe binding works only when both service and client are running on the same machine so there is assumption that if user has permissions to log in and the service is running she have also permission to call it. If you need to restrict users who can call the service you can always use custom authorization manager or role based security.
I'm using IE8 and can't connect to my WCF service using net.tcp. I'm able to access the same service with http binding just fine. I got two binding enabled in app.config (net.tcp, http). Can anyone tell me if there is a settings that I need to set/play with for viewing service using net.tcp in IE.
You cannot connect to a WCF service using the netTcpBinding through IE.
What you need is a "real" WCF client app, or something like WCF Test Client which is shipped with WCF in the box - just find it and start using it!
Make sure you have a HTTP base address, for your service and a mexTcpBinding endpoint.
I have created a WCF service which is deployed on my local machine. This service exposes one method which start/stop a windows service on my local machine.
On the remote machine I have created a client that consumes the WCF service. When I try to invoke the method which start/stop service exposed from a WCF service , I get InvalidOperationException . I found that this is the Security issue.
Also when I do the same operation (start/stop windows service) on the local machine it works!!
The WCF service is hosted on IIS 7.0 which is using basichttpBinding. Also Anonnymous access is checked. I have also added <identity Impersonate = true > under the web section in the web config file but still no success.
Please help!!
You set impersonation for ASP.NET. Impersonation in WCF uses its own infrastructure. Moreover in WCF client has to allow service to impersonate his identity. Check this simple example.