WCF netpipe created in non admin mode has connection issues - c#

I have created WCF netpipe connection on "net.pipe://localhost/IBS" which has an endpoint listening at "BasicService".
Creating this and hosting within my app is fine. But when I try to connect to this through "net.pipe://localhost/IBS/BasicService" this connection fails.
It throws exception like following.
There was no endpoint listening at **net.pipe://localhost/IBS/BasicService** that could accept the message.
This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
While digging into this, I found that this connection failure happens only when the hosting app is running in non-admin mode. If I switch to admin mode the connection succeeds.
The issue happens because some other pipe is open on net.pipe://localhost in admin mode. So while my client tries to communicate to net.pipe://localhost/IBS/BasicService it ends up searching in net.pipe://localhost for IBS/BasicService. Where as i wanted it to search in net.pipe://localhost/IBS for BasicService.
Services running in admin mode is taking precedence. Is there a way in WCF to configure it other way or at-least after not finding at localhost it should try finding in localhost/IBS also.
Thanks.

Related

IIS Website Application doesnt work anything but port 80

I wrote a WCF service in visual studio 2017. I then added this service to IIS (not the express version but the full fledge IIS). It is added as an application under the default created website. I can access my service end-point without any issues at http://localhost/<websitename>/MyService.svc/test/123. /test/123 is just a simple GET endpoint.
The default website is already configured for port 80.
However, when I changed the port from 80 to say, 1234, it does not work. It merely returns me "Service Unavailable. HTTP Error 503." when I hit the /test/123 endpoint.
I have already executed the console command to add the port to ACL netsh http add urlacl url=http://+:1234/ user=everyone.
Does anyone know how can I get another port (non 80) to work?
Edit:
I am aware that there is an answer How to run WCF service on a specific port which explains how to bind to another port. However, the accepted answer uses the net.tcp protocol. I would like to use the HTTP protocol.
Is there any way to do it with HTTP protocol? If it cannot be done, then I guess ill have to redesign and swap over to net.tcp protocol.
I am extremely new to .NET development and WCF, so hopefully somebody with experience can point me in the right direction.
As it turns out, the problem had nothing to do with the so-called linked answer.
Prior to running my WCF service in IIS, I was trying to deploy it as a WAS and then Console application. In my process of getting those 2 implementations to work, I had to execute the command netsh http add urlacl url=http://+:1234/ user=everyone so that the port could be accessed.
By sheer luck, i stumbled upon this link:
https://serverfault.com/questions/666976/service-unavailable-if-i-try-to-access-iis-website-via-ip-address-works-fine-vi
Although it didnt have an accepted answer, the comments held the answer. My problem was caused exactly because I executed the netsh command. What happens is that the command causes that ip/port to be reserved, and thus, IIS cannot attach to the ip/port and therefore the Service Unavailable error. I assumed that if the WAS and Console version needed that command to be executed, then the IIS version needed it as well.
As for letting an IIS WCF Service be available on any other port, the process is super simple. Within IIS itself (Execute "inetmgr" in Run to launch), in the default or custom website you created, edit the binding and change the HTTP port to whatever port that you want. After that, its done. You should be able to access your application/website from that port via HTTP.
Eg:
http://localhost:<some port>/<websitename>/MyService.svc/test/123
My WCF Service config was a standard config that allowed for HTTP access.
If you would like to access it from another computer or from the internet, then you will need to configure your router to port forward your selected port (if needed) and ensure that your firewall allows data flow for that port.
Many "thanks" to the downvoters who assume this was some duplicate. Your "help" contributed in finding a solution to the problem.

WCF http services blocked by windows 10 firewall

I have 3 self hosted WCF windows services communicating with each other over http port 80 using basic http binding. On the same machine I have a website (also running on default port 80) hosted in IIS which also manages and communicates with one of those services. Everything works fine within this windows 10 hosting machine i.e. the website can talk to the services and the services can talk to each other.
When I try to access the website from another PC on the network I get a message in the browser saying 'server DNS address could not be found'. I can't even access the WCF service metadata url.
This looks like a firewall issue on the host machine so I added inbound and outbound rules for TCP port 80 and made sure the rules 'World Wide Web Services (HTTP Traffic-In)' and 'World Wide Web Services (HTTPS Traffic-In)' are enabled. None of these changes worked so I removed the TCP rules I added.
Finally I disabled the firewall completely and I was able to access the website from another PC. However, when I re-enabled the firewall, the website continued to work and all of a sudden my WCF metadata is also accessible!
I don't understand why this is happening. I have successfully recreated the problem several times.
Can anyone offer an explanation or suggest any other firewall rules to try?
My end goal is to package up the services and website into an installer so I don't want my end users to have to mess around with the firewall. They may not even be able to turn it off and on again.
Many Thanks
How about outbound rules on port 80 for http?
Finally figured it out. The url I was using to access the hosting machine used the machines name. In order for the machine to respond to a name lookup was to enable the firewall rule called 'Network Discovery (NB-Name-In)' for the public profile. This rule allows traffic on UDP port 137. Once the name lookup has been cached the url will be properly routed. This explains why it worked after I disabled then enabled the firewall again.

WCF service EndPointNotFoundException - incorrect proxy server error message

I have a Visual Studio application which makes heavy use of WCF services. Normally, the team can just download the app from SVN and run and it uses proxy settings from IE and everything is fine.
A new member of the team has just tried to do the same and as soon as the code tries to connect a service client the message similar to below is shown
There was no endpoint listening at http://servername/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond *10.1.2.252:8080*
It is interesting that 10.1.2.252:8080 should be mentioned as I can find no mention of that in either IE proxy settings or netsh so I have no idea where it is originating from.
I can bypass the problem by adding useDefaultWebProxy="false" to the bindings but as no other users get this I want to get to the bottom of this.
Does anyone have any suggestions on where the incorrect proxy address may be originating from - (it is not in any files in the solution as I have searched for it)?

403 Error For Web Service Call

I am using a 3rd-party tool that runs as a Microsoft Service on a Windows Server 2008 R2 machine. The machine is using a Dell SonicWall firewall. The tool has defined ports that it is listening on of which I have opened one. Using an external web tool that port is listed as open. The service has been installed and shows as running when I run services.msc.
Everything runs great on my local machine. However, when I try to query the service I get a 403 error. The following is what the query URL looks like:
https://{siteUrl}:{portNumber}/scanservice/v2/getstatus?method=jQuery111106758983342442662_1428439579840&_=1428439579841
This is an AJAX GET request coming from an ASP.NET MVC application.
The code attempts to find an open port by querying 3 ports that are the https ports for the service. The first two are ports that I have not opened on the machine. These queries time out which is what I would expect. The last port is the one I have opened on the server. I immediately get a 403 error.
Is there somewhere where I need to expressly allow that service, not just the port?
It is a case where your public IP is not whitelisted on the web service hosting server

EndpointNotFoundException [in Windows Mobile 6.5.3 APP]

Brief summary of the "problem":
I have created a host according to these instructions: LINK; and then according to this instruction for a Windows Mobile 6.5.3 application i created the classes for the connection (via NetCFSvcUtil).
Now it is so that I get the following error message (if I "get" me want data):
Error message:
There was no endpoint listening at http://localhost:8500/MyService
that could accept the message. This is often caused by an incorrect
address or SOAP action. See InnerException, if present, for more details.
Oddly enough (to me, in fact, inexplicable), when I go to the very same principle (this time SvcUtil) a "non Compact Framework" make application to me, I can easily query my "data".
In addition: Both times were by Tool (depending on the application one for CF and one for the "normal") created and incorporated the required classes (successful); but unfortunately only works the query in the desktop application.
Anyone has any advice?
This error is caused by host and client machines are different. When you try to reach
http://localhost:8500/MyService
using svcutil, since its on the local machine, you can access. But when you try to access using Emulator or phone, it tries to reach its own ip adress.
How will you solve:
Install IIS and setup a site containing that service.
Reference to your computer ip adress instead of localhost from client.

Categories

Resources