WCF and 127.0.0.1 vs localhost - wcf

Is there a different between using 127.0.0.1 vs localhost?
I ask this because I have noticed a difference when defining wcf connections.
<client>
<endpoint binding="netTcpBinding" bindingConfiguration="netTcpNosecurity" contract="MyClass" name="MyName" behaviorConfiguration="megaGraphBehavior" address="net.tcp://localhost:8011/myname" />
</client>
In some environments i have noticed that a server suddenly starts throwing this error when using localhost and i can only make it work by using 127.0.0.1.
Could not connect to net.tcp://localhost:8011/myname. The connection attempt lasted for a time span of 00:00:02.2341176. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8011. ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8011
How can this be explained and should i always use 127.0.0.1?

Localhost by default references the IPv6 address on IPv6 enabled machines. Perhaps the server-side endpoint is only accessible via IPv4?

I just had this problem today, and I just randomly solved it (I do not understand why these are here).
See this screenshot:
See where I had Auto-assign Port checked and Specific port 59816 was NOT checked?
See where the message box shows localhost:59816 and 127.0.0.1:59816?
I fixed my issue by checking Specific port 59816.
This just might solve your problem, too.

Related

When I use libvirt api to migration,occur a error like this

libvirt.libvirtError: unable to connect to server at 'ccrfox112:49152': Connection timed out
When migrating QEMU guests, without tunnelling via libvirtd, QEMU will listen on a port number in the range 49152->49216 for a connection from the source host. This error messages shows that the source host was unable to connect to the target host. You've not provided any useful information about your setup, so I'd have to guess that probably you have firewall rules on the target host that are blocking the source host access to the TCP port in question.

change the net tcp port of a wcf service running on windows service

I'm using this example:
http://msdn.microsoft.com/en-us/library/ms733069.aspx
How do I change the port or specify a port and open it and all the other good stuff needed to access the service?
read this manual http://msdn.microsoft.com/en-us/library/ms734786.aspx or at least finish reading of your link up to 13th point in list, where configuration file is provided
according to standard, URL consists of:
protocol :// hostname [: portnumber] [/path]
so, you need to change 8080 in your config to proper port
<add baseAddress="http://localhost:8000/ServiceModelSamples/service"/>

Succeeded installing but could not start apache 2.4 on my windows 7 system

I am attempting to install and run apache 2.4 on my windows 7 system
I went to the apache 2.4 bin directory and ran the following:
Note: I opened the cmd window as administrator.
C:\Apache24\bin>httpd.exe -k install
Its output was as follows:
Installing the Apache2.4 service
The Apache2.4 service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions. : AH00072: make_sock: could not bind to address [::]:80
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions. : AH00072: make_sock: could not bind to address 0.0.0.0:80
AH00451: no listening sockets available, shutting down
AH00015: Unable to open log
So it installed apache 2.4 as a service but it could not be started. It seems like the localhost port 80 is being used. Is this what "[::]:80" means?
I then stopped both the the apache 2.0 service which I had left running and the mysql service, hoping stopping one of them might free up localhost port 80.
I also run netstat -o to see if port 80 is being used. It was not.
But, I then found that a process was using the above socket it is a process that is listening on the above socket
TCP [::]:80 User-PC:0 LISTENING 4
I then ran tasklist and found out that System is using pid 4. 4 is under the pid column
System 4 Services 0 544 K
Finally, from the failed attempt to start the service
I got an error which was recorded in windows systems events.
Log Name: System
Source: Service Control Manager
Date: 2/21/2013 1:58:03 PM
Event ID: 7024
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: User-PC
Description:
The Apache2.4 service terminated with service-specific error Incorrect function.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Service Control Manager" Guid="{555908d1-a6d7-4695-8e1e-26931d2012f4}" EventSourceName="Service Control Manager" />
<EventID Qualifiers="49152">7024</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8080000000000000</Keywords>
<TimeCreated SystemTime="2013-02-21T18:58:03.723988900Z" />
<EventRecordID>87756</EventRecordID>
<Correlation />
<Execution ProcessID="560" ThreadID="7596" />
<Channel>System</Channel>
<Computer>User-PC</Computer>
<Security />
</System>
<EventData>
<Data Name="param1">Apache2.4</Data>
<Data Name="param2">%%1</Data>
</EventData>
</Event>
The error from the attempt to start says that beacause of lack of access, make-sock could not bind to sockets which to me looked like localhost port 80. For example,
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions. : AH00072: make_sock: could not bind to address [::]:80
Can anyone tell what I am doing wrong?
Sorry for the belabored question. To solve my problem I just told apache 2.4 to listen to a different port in httpd.conf. Since System was using pid 4 which was listening on port 80, I did not want to explore this any further.
I put the following into httpd.conf.
Listen 127.0.0.1:122
The most likely culprit is Microsoft Internet Information Server. You can stop the service from the command line on Windows 7/Vista:
net stop was /y
or XP:
net stop iisadmin /y
read this
http://www.sitepoint.com/unblock-port-80-on-windows-run-apache/
I have the same problem too, after upgrading win7 to win10.
then I check services.msc and found "World Wide Web Publishing Service" was running automatically by default.
So then I disabled it, and running the Apache service again.
Port 80 maybe used by Microsoft HTTPAPI
Try to stop the following service:
Web Deployment Agent Service
SQL Server Reporting Service
SQL Server VSS Writer
I solved this issue finally, it was because of some systems like skype and system processes take that port 80, you can make check using netstat -ao for port 80
Kindly find the following steps
After installing your Apache HTTP go to the bin folder using cmd
Install it as a service using httpd.exe -k install even when you see the error never mind
Now make sure the service is installed (even if not started) according to your os
Restart the system, then you will find the Apache service will be the first one to take the 80 port,
Congratulations the issue is solved.
In my case, it was due to an IP address that Apache is listening to. Previously I have set it to 192.168.10.6 and recently Apache service is not running. I noticed that due to My laptop wifi changed recently and new IP is different. After fixing the wifi IP to laptop previous IP, Apache service is running again without any error.
Also if you don't want to change wifi IP then remove/comment that hardcode IP in httpd.conf file to resolve conflict.
if you are using windows os and believe that skype is not the suspect, then you might want to check the task manager and check the "Show processes from all users" and make sure that there is NO entry for httpd.exe. Otherwise, end its process. That solves my problem.
So, that is why i do a two (or more) post.
I was having the same problem when starting the service (logs can not be opened).
I thought it was because i was trying to have htdocs inside a VeraCrypt encripted container, absurd since i hace such contained mounted and i use a juntion to not affect paths.
The i read the cause could be low ram: after some tests i get to the next conclusion.
Windows is not sending pages to virtual ram to free enough ram if it is a service, for applications it is doing it, i have more than 200GiB of pagefile ready to be used as virtual ram in a 4GiB 64 Bit windows 10.
My solution:
Run a free utility that free ram (512MiB in my test)
Inmediatly after start the service, it starts with no errors
Real Cause:
I was using a virtual machine that uses 1/2 physical free ram (1.5GiB)
Hope this help others.
I was also facing the same issue, then i tried restarting my system after every change and it worked for me:
Uninstall Apache2.4 in cmd prompt (run administrator) with the command:
httpd -k uninstall.
Restart the system.
open cmd prompt (run administrator) with the command:
httpd -k install.
Then httpd -k install.
Hope you find useful.
you can solve it
sudo nano /etc/apache2/ports.conf
and changed Listen to 8080
This may be because of shortage in physical RAM.
Check minimum system requirements in the docs and try to close unnecessary programs if possible.

IIS 7 Site using HTTPS not Accessible from Outside Internet (is accessible from intranet)

I am trying to set up an HTTPS site on IIS 7. I have added the certificate, set up the appropriate bindings and the site is accesible from within my company's intranet, however no one from the outside internet can access it. I have a 1:1 NAT forward set up for port 443 that should route requests to the IP address for my server. I have the same situation for port 80 and don't have any issues with http sites being accessible.
Any suggestions for what I might be missing here?
UPDATE:
As it turns out, the company that manages my company's firewall had added the exception for https and 443, and the correct routing, but hadn't added an exception for the process that handles https.
For starters, from outside, use telnet to see if you can even get to the port from outside:
telnet <host name or ip> 443
Note the space before the port.
If the telnet screen goes fully black, w cursor in top left, you can connect, so it is an iis issue.
If telnet just sits there, it is trying to connect but can't. It may finally throw "connection refused" or "could not connect." This means the problem is on the physical firewall (which needs the inbound path opened) or on the iis server itself (in its firewall or iis config)
In this case, next step:
Do the telnet operation on the IIS server itself, and from the same network as IIS (e.g. not through the firewall).
-- If this works: The problem is the network firewall config
-- If this does not work, you need to check the firewall on the IIS server itself (the windows firewall), and the IIS config itself
Note, on windows 7 and vista, telnet may not be present out of the box. Google how to enable it.

Localhost issue with Net.Msmq endpoints on Windows 7

I've just moved my development to a Win 7 64-bit machine and am having some wcf endpoint issues. As far as I can see the net.msmq endpoints that point to localhost do not work. The messages do get sent but appear in an outgoing msmq queue that constantly says 'Waiting to Connect'. As far as I was aware msmq messages sent to a private queue on a local machine were just put into the target queue automatically and not into an outgoing queue? Could it be that it thinks that 127.0.0.1 is somewhere else?
When I change the host address in the endpoint to the name of my machine or my ip address the application performs correctly and no outgoing queue is apparent and the messages get sent/arrive correctly. Could this be an ipv6 issue? Using 'localhost' in the endpoints works fine on my previous machine which was XP sp3.
I've had this issue with WCF and net.tcp/http on Vista and Win7- it's probably an IPv6 issue. If your listener is bound to 127.0.0.1, it won't work since localhost will first resolve to ::1. Make sure your listener is also bound there. In Vista, you could remove ::1 from the hosts file, but in Win7, that's no longer an option. Grr.