473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

connecting to localhost

Hi,

I have got a scenario where an asp script needs to request via xmlhttp a
file sitting on the same server. The code all works find on my local
machine. However, on the hosting server, it does not. The problem is
that I am on a shared server and the server can't "see itself", i.e.
it's probably blocked by the host to receive request from itself. The
problems comes in as the server will hold multiple sites and use host
headers to channel request. I thought of using "localhost" and some kind
of header sending scenario to get the server to go to the correct
subfolder/virtual host. However, googling has not brought up much. Has
anyone got ideas/similar scenarios and could point me in some helpful
directions?

Thanks

Christoph
Jul 22 '05 #1
7 1852
What do you mean, it can't see itself? Is this a DNS name resolution issue?
That's my guess. Ask your host if the server is able to resolve dns names,
and if not, if it's possible to make it so that it can. Since the server is
using host headers, you will have to make the http request to your site by
one of the recognized host header names. If the server doesn't have any DNS
server setting, this won't be possible, afaIk.

Ray at work

"Christoph Lutz" <CL***@gmx.net> wrote in message
news:42**********************@ptn-nntp-reader03.plus.net...
Hi,

I have got a scenario where an asp script needs to request via xmlhttp a
file sitting on the same server. The code all works find on my local
machine. However, on the hosting server, it does not. The problem is
that I am on a shared server and the server can't "see itself", i.e.
it's probably blocked by the host to receive request from itself. The
problems comes in as the server will hold multiple sites and use host
headers to channel request. I thought of using "localhost" and some kind
of header sending scenario to get the server to go to the correct
subfolder/virtual host. However, googling has not brought up much. Has
anyone got ideas/similar scenarios and could point me in some helpful
directions?

Thanks

Christoph

Jul 22 '05 #2
Ray,

The server can't resolve DNS - even if it could, there would most likely
be firewall and NAT issues, so the only reliable way is to connect to
localhost and then send the appropriate headers. I am looking at opening
sockets and sending appropriate headers - or indeed any other way that
achieves the same by using localhost is what I need. Anyone?

Christoph

Ray Costanzo [MVP] wrote:
What do you mean, it can't see itself? Is this a DNS name resolution issue?
That's my guess. Ask your host if the server is able to resolve dns names,
and if not, if it's possible to make it so that it can. Since the server is
using host headers, you will have to make the http request to your site by
one of the recognized host header names. If the server doesn't have any DNS
server setting, this won't be possible, afaIk.

Ray at work

"Christoph Lutz" <CL***@gmx.net> wrote in message
news:42**********************@ptn-nntp-reader03.plus.net...
Hi,

I have got a scenario where an asp script needs to request via xmlhttp a
file sitting on the same server. The code all works find on my local
machine. However, on the hosting server, it does not. The problem is
that I am on a shared server and the server can't "see itself", i.e.
it's probably blocked by the host to receive request from itself. The
problems comes in as the server will hold multiple sites and use host
headers to channel request. I thought of using "localhost" and some kind
of header sending scenario to get the server to go to the correct
subfolder/virtual host. However, googling has not brought up much. Has
anyone got ideas/similar scenarios and could point me in some helpful
directions?

Thanks

Christoph


Jul 22 '05 #3
> The server can't resolve DNS - even if it could, there would most likely
be firewall and NAT issues, so the only reliable way is to connect to
localhost and then send the appropriate headers. I am looking at opening
sockets and sending appropriate headers - or indeed any other way that
achieves the same by using localhost is what I need. Anyone?


You will need to ask the host how to access your virtual directory /
application by IP/localhost. Usually (but not always) there is a way to get
at each directory without using the host header, e.g.
http://localhost/applications/yourcompany/ instead of
http://www.yourcompany.com/ Again, usually, but not always.

Or, look at a different way to grab the results of the file you are calling.
Can't you replicate its functionality in the current page so that an HTTP
request is not required?

A
Jul 22 '05 #4
If this server were sitting next to you, another option would be to put an
entry in the HOSTS file (typically in %windir%\system32\drivers\etc) that
resoluves to 127.0.0.1, but has a name other than localhost. Then you'd add
that name as another host header for your site. Is this an option?

Ray at work

"Christoph Lutz" <CL***@gmx.net> wrote in message
news:42**********************@ptn-nntp-reader03.plus.net...
Ray,

The server can't resolve DNS - even if it could, there would most likely
be firewall and NAT issues, so the only reliable way is to connect to
localhost and then send the appropriate headers. I am looking at opening
sockets and sending appropriate headers - or indeed any other way that
achieves the same by using localhost is what I need. Anyone?

Christoph

Ray Costanzo [MVP] wrote:
What do you mean, it can't see itself? Is this a DNS name resolution issue? That's my guess. Ask your host if the server is able to resolve dns names, and if not, if it's possible to make it so that it can. Since the server is using host headers, you will have to make the http request to your site by one of the recognized host header names. If the server doesn't have any DNS server setting, this won't be possible, afaIk.

Ray at work

"Christoph Lutz" <CL***@gmx.net> wrote in message
news:42**********************@ptn-nntp-reader03.plus.net...
Hi,

I have got a scenario where an asp script needs to request via xmlhttp a
file sitting on the same server. The code all works find on my local
machine. However, on the hosting server, it does not. The problem is
that I am on a shared server and the server can't "see itself", i.e.
it's probably blocked by the host to receive request from itself. The
problems comes in as the server will hold multiple sites and use host
headers to channel request. I thought of using "localhost" and some kind
of header sending scenario to get the server to go to the correct
subfolder/virtual host. However, googling has not brought up much. Has
anyone got ideas/similar scenarios and could point me in some helpful
directions?

Thanks

Christoph


Jul 22 '05 #5
Hi Aaron,

Thanks for your reply. Accessing via your other method might be an
option. I will need to investigate - but as you say, it's not always the
case and I am really looking for a universal option. Thank you,though

Christoph

Aaron Bertrand [SQL Server MVP] wrote:
The server can't resolve DNS - even if it could, there would most likely
be firewall and NAT issues, so the only reliable way is to connect to
localhost and then send the appropriate headers. I am looking at opening
sockets and sending appropriate headers - or indeed any other way that
achieves the same by using localhost is what I need. Anyone?

You will need to ask the host how to access your virtual directory /
application by IP/localhost. Usually (but not always) there is a way to get
at each directory without using the host header, e.g.
http://localhost/applications/yourcompany/ instead of
http://www.yourcompany.com/ Again, usually, but not always.

Or, look at a different way to grab the results of the file you are calling.
Can't you replicate its functionality in the current page so that an HTTP
request is not required?

A

Jul 22 '05 #6
Ray,

Thanks for your reply. Unfortunately I won't be able to alter the hosts
file. Plus the problem is not that I can't access the local server via
localhost - it's more: where do I go from here, i.e. how do I then
access my virtual server. This is where the host header scenario comes in.

Thanks

Christoph

Ray Costanzo [MVP] wrote:
If this server were sitting next to you, another option would be to put an
entry in the HOSTS file (typically in %windir%\system32\drivers\etc) that
resoluves to 127.0.0.1, but has a name other than localhost. Then you'd add
that name as another host header for your site. Is this an option?

Ray at work

"Christoph Lutz" <CL***@gmx.net> wrote in message
news:42**********************@ptn-nntp-reader03.plus.net...
Ray,

The server can't resolve DNS - even if it could, there would most likely
be firewall and NAT issues, so the only reliable way is to connect to
localhost and then send the appropriate headers. I am looking at opening
sockets and sending appropriate headers - or indeed any other way that
achieves the same by using localhost is what I need. Anyone?

Christoph

Ray Costanzo [MVP] wrote:
What do you mean, it can't see itself? Is this a DNS name resolution
issue?
That's my guess. Ask your host if the server is able to resolve dns
names,
and if not, if it's possible to make it so that it can. Since the
server is
using host headers, you will have to make the http request to your site
by
one of the recognized host header names. If the server doesn't have any
DNS
server setting, this won't be possible, afaIk.

Ray at work

"Christoph Lutz" <CL***@gmx.net> wrote in message
news:42**********************@ptn-nntp-reader03.plus.net...
Hi,

I have got a scenario where an asp script needs to request via xmlhttp a
file sitting on the same server. The code all works find on my local
machine. However, on the hosting server, it does not. The problem is
that I am on a shared server and the server can't "see itself", i.e.
it's probably blocked by the host to receive request from itself. The
problems comes in as the server will hold multiple sites and use host
headers to channel request. I thought of using "localhost" and some kind
of header sending scenario to get the server to go to the correct
subfolder/virtual host. However, googling has not brought up much. Has
anyone got ideas/similar scenarios and could point me in some helpful
directions?

Thanks

Christoph


Jul 22 '05 #7
On Fri, 08 Jul 2005 15:29:39 +0100, Christoph Lutz <CL***@gmx.net>
wrote:
I have got a scenario where an asp script needs to request via xmlhttp a
file sitting on the same server. The code all works find on my local
machine. However, on the hosting server, it does not. The problem is
that I am on a shared server and the server can't "see itself", i.e.
it's probably blocked by the host to receive request from itself. The
problems comes in as the server will hold multiple sites and use host
headers to channel request. I thought of using "localhost" and some kind
of header sending scenario to get the server to go to the correct
subfolder/virtual host. However, googling has not brought up much. Has
anyone got ideas/similar scenarios and could point me in some helpful
directions?


"Localhost" won't do it unless there's a localhost header in the host
headers for a site. Use a different method to address the system,
such as the actual host name, FQDN, IP address or whatever.

Jeff
Jul 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: maddunr | last post by:
Hi, I just installed PHP 4.3.9, MySQL 4.0.2 and PHPMyAdmin 2.6.0-pl3 on our intranet server (Win2k3 running IIS). I also have a similar setup on my local machine (http://localhost/phpmyadmin). ...
5
by: Maurice LING | last post by:
Hi, I've been using FB1.5 and access the database using Kinterbasdb + Python. My connection is established using kinterbasdb.connect() method and the parameters host, dns, database, user,...
6
by: MBS | last post by:
Yeah, read the previous posts...I did that. None answer my question. I just installed PHP 5.0.4, Apache 2.0.54, and MySQL 4.1.13 a few days ago on WinXP SP2. My goal is to learn to use these...
4
by: CodeImp | last post by:
A simple app I quickly wrote to try getting info from a database. Here is the first part of its code. The rest of the code is irellevant. using System; using System.Data; using...
14
by: John Spiegel | last post by:
Hi all, I'm missing something, probably stupid, on connecting to a SQL Server database from an aspx file. I haven't really done much w/ SQL Server and suspect that it's a problem on that side. ...
1
by: scottrm | last post by:
We have multiple developers all using a shared development server. Recently we have migrated to a new server. I copied all the project folders across and created virtual directories mapped to and...
7
by: Frances | last post by:
this seems pretty straight-forward.. got this code $link = mysql_connect('localhost:3306', '<uid>', '<pswd>'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected...
9
by: darthghandi | last post by:
I am trying to create a server application using asynchronous sockets. I run into a problem when I try to connect to my server using a non-.net program. I can establish the connection, and send...
0
by: brum2008 | last post by:
Hello! Below is the Netbeans Mobility source code for my application (The application offers SPP service, and then just hangs waiting for a client to connect (using acceptAndOpen()). The other...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.