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.
Related
I'm able to successfully deploy my MVC app onto localhost listening on port 7051.
Connecting to https://localhost:7051/ or https://127.0.0.1:7051/ works fine. However, connecting to https://192.168.201.194:7051/ (my LAN IPV4) does not.
How can I configure ASP.Net to listen to non-localhost requests?
There is no information in the docs and all similar questions are very badly outdated.
Any help would be greatly appreciated.
It should be accessible if something in middle is not interfering.
Did you enable World Wide Web Services (HTTP Traffic In) from firewall ?
Try enabling it from Inbound Rules (Control Panel -> Windows Firewall -> Advanced Settings -> Inbound Rules) and you should access localhost from LAN.
I'm using Owin and Topshelf to selfhost an ASP.net Web Api.
I am able to access it through localhost and 127.0.0.1 on the device that is self hosting it.
The idea is that any device that comes onto the network and has my computer or mobile application installed is able to communicate with that web api to request/update/remove data from the database hanging behind.
The issue i am having is that i have no way of finding out on what internal ip the service is actually running. I have no control/view over the network that it's installed onto (except through my code), this means i don't know what the ip or hostname might be, only the port number (on any other device that isn't hosting it).
I tried adding custom url's like shown below
StartOptions options = new StartOptions();
options.Urls.Add("http://localhost:6969");
options.Urls.Add("http://127.0.0.1:6969");
options.Urls.Add(string.Format("http://{0}:6969", Environment.MachineName));
options.Urls.Add("http://+:6969");
Obviously localhost and 127.0.0.1 won't work for a remote device on the same network. The issue with the MachineName is that i don't have a say in the name of the machine either, meaning this could be anything. I assumued the wildcard would allow me to send a request on port 6969 and the host would catch it, this was sadly not the case.
This leaves me in a bit of an issue, i now have a self hosted Web api, on a machine with a random ip and name, and it needs to be accessed by other devices on the same network, The users are not able to manually enter ip, and i can't force a name onto the host computer. This all leaves me in a situation where im not sure wat else i could try, or if its even possible to reach the host computer without human interference.
Edit: I did come across something along the lines of a
network broadcast address
Which should in someway allow me to send out a message from a device, and let the server respond with its ip. Not sure how i would apply this to my self hosted web api though.
Basically, the idea is to have your web API application register its address to a service, such as DNS, which may be updating the IP address of a DNS A record. Then clients will query this service or DNS, to resolve the address to your application.
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.
We have a WCF application with multiple bindings running on Windows Services, the application is working as expected on an intranet environment however when we deployed our solution to windows azure VM, it seems all our services are running fine except those that uses wsdualhttpbinding binding !!!
Our services are running on port 8099 therefore we created an endpoint on VM with public and private ports set to 8099, we also disabled the firewall for the time being. we even try to use Azure network to establish a point to site VPN but none of them worked.
we set the base address as http://XXX.cloudapp.net:8099/MYSvc but again same issue...
This solution is working fine if I run the client application on the same machine that hosts the services on azure however if I try to use another machine it fails. I even tried to create another VM on the same subnet and run the client app from within azure network to replicate an Intranet environment, again no success...
There is no error to copy here, it seems when the client app reaches a duplex service, it keeps waiting for a response and does not allow user to do anything!
Is it because of traffic routing or .... any suggestion? are we missing something?
We prefer to use wsdualhttpbinding unless there is no solution...
Since nobody answered the question and due to the fact I found a solution, I like to share it here in case somebody need it.
On azure wsdualhttpbinding cannot find the client address just because of routing issues, so even if you use VPN the issue persists.
The solution is to use ClientBaseAddress as for your wsdualhttpbinding binding like so:
WSDualHttpBinding dualBinding = new WSDualHttpBinding();
EndpointAddress endptadr = new EndpointAddress("http://XXX:12000/DuplexTestUsingCode/Server");
dualBinding.ClientBaseAddress = new Uri("http://XXX:8000/DuplexTestUsingCode/Client/");
refer to this link
http://msdn.microsoft.com/en-us/library/system.servicemodel.wsdualhttpbinding.clientbaseaddress(v=vs.110).aspx
and aslo here:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/e5fca7a5-9a90-48de-a81c-ec2e18b7ae6a/wsdualhttpbinding-and-clients-on-remote-machines
You have to bear in mind that the load balancer closes any idle connections after one minute. You can't turn off this behavior on Azure, so if your process takes more than a minutes, the callback channel will be closed by load balancer and you get timeout exception.
I am new to IIS and asp and i am having a problem. I am creating a asp.net website in physical folder wwwroot\SharePage and virtual directory SharePage When i visit the site on local host or using my ip address or through dyndns proxy on my own computer , the page is served fine, But when any one else from any other computer access my website it takes a long time in loading and finally his browser throws an error (may be page not found error,not sure, see for yourself). I have even changed Authentication mode to none and tried with firewalls closed , still page is not served.
You can have a look here
http://thesharepage.dyndns.org/SharePage
(hosted on my home computer so can be unavailable at times when i have switched off my computer)
or try with my ip address
updated
http://117.205.103.192/SharePage/
(can change ,i have a dynamic ip address)
Info:
IIS version 7.5
OS : Windows 7
.Net 4 (even in IIS)
please help quick, have to launch it on New Year
Port 80 isn't open to the outside world (I can't telnet to it). Sounds like IIS is working but your router needs some configuring to forward that port to the server.
I don't think so it is an IIS issue, possible related to firewall. You may need to enable 80 port in your firewall. You may also need to enable port forwarding in your router, even http://thesharepage.dyndns.org/ is not accessible from here.
It seems you have not allowed outsiders to access your webserver from outside. This is the default setting in the firewall. Change the setting in your firewall and things will be alright.