Invalid URI for Localhost - asp.net

We have a website/webservice running on one of our servers. We hit that webservice once a day with a scheduled .bat scipt.
Just recently the scheduled task started to fail. The log shows "Invalid URI: The hostname could not be parsed."
When we're logged into the server we can reach the website through http://localhost/website, but get an Invalid URI error when we hit the webservice http://localhost/website/ws.asmx.
Any ideas?
Edit:
We'be tried using the servername, the ipaddress, and port numbers (and combinations therein). Any other ideas?

For the private IP Address your using Wikipedia Reference http://en.wikipedia.org/wiki/IP_address for what are the limits and proper uses.
If you have access to the source code for the web service look for fixed IP Address being used along with having correct Server Bindings for using the service.

Try using the IP Address of the machine instead of localhost.
Basically, I'm taking a wild stab that someone ran a lockdown or a service patch was installed that somehow is filtering request resposes to localhost (127.0.0.1).

Try using the machine name instead of localhost

Related

Unable to resolve CRM web application url with hostname from outside browsers

I have a deployment created with crm 2016 on-premise.
After installation. I am unable to use the webapplication URL from browsers outside the server.
If I use FQDN NAME-IT IS GETTING RESOLVING and able to access org. Eg:
http://testserver.testserverdom.com/Englishorg
If I use hostname url-it is not resolving and getting blank page. Eg:
http://testserver/EnglishOrg
Again if I add host entry in drivers/etc/hosts file in the outside machine like 10.10.10.10 testserver. Able to resolve and access URL.
I have added hostname(A) entry in DNS. I am still unable to resolve it with hostname.
Server have DHCP Assigned IP Address.
I believe you might be having the DNS issue on client - side (outside of you server) which cannot correctly resolve your testserver.
If you run cmd and there try nslookup testserver- you should see if this is resolved with the correct ip address (according you your hosts file change this should be 10.10.10.10). If this does not -- I believe the problem is in DNS query / response, please make sure your local DNS server is configured correctly and make sure your local DNS server is sending back the response to your client.

IP address issue when deployed in Server

I have a Servlet project developed using Tomcat 7.
My projects logic is that whenever a request comes from certain IP it responds to the same IP with a new instance of browser as an response.
When I run and test this application locally it works perfect and by the way my local working IP address will be something like this 10.52.xxx.xxx. So request has 10.52.xxx.xxx and response is given to 10.52.xxx.xxx and all happies
Now things looks perfect and I planned to deploy this project in a Server which has an IP addess of 172.32.xxx.xxx and I have completed deployment of the same.
Now the issue which I am facing is that when I try to make a request to the project in the server (172.32.xxx.xxx) from my network (10.52.xxx.xxx).
In my project I have code like
String ip = request.getRemoteAddr(); //gets request IP address to give a new instance of browser
Now the variable ip contains an IP address of 172.32.xxx.xxx. So my code will try to give a browser instance to 172.32.xxx.xxx which doesn't exist. It should ideally give the browser instance back to 10.52.xxx.xxx as this is from which it had received the request so it has to respond to this IP.
I know both Server and the client request are in different IP network but I would like to know all possible solutions to fix the same so that browser is given back to 10.52.xxx.xxx.
Any help highly appreciated.

Error due to difference between localhost and local IP address

I have visited to this link and got to know about the differences between localhost and localIP address.
I have got problem saying Access is denied while accessing my own asp.net api hosted
in my local IIS server with the following url
http://172.18.12.166/FinalApi/api/movie.
It works finely if I use following url to access the api
http://localhost/FinalApi/api/movie
In the console of browser the request can be visualized as
This means the request is completed with no error. But this returns no data if I use localIP address in case of localhost.
But this works finely while requesting from other computers on the same network.
Look for host file at the following location on your system:
C:\WINDOWS\system32\drivers\etc
in that change the mapping of localhost (by default it would be 127.0.0.1). Change it to map to your IP. Then set up the you website in IIS server as per IP address.
Hope this helps.

IIS 6 asks for authentication when using hostname

We have a website to which we have now added Windows authenication. Now when I release my changes to the server,IIS asks for Authenication, and after trying with right credentials for 3 times, I get Not autorized error.
If I try to access the website from within the server using localhost, it works fine. It also works fine if accessed remotely using IP address instead of hostname.
http://localhost/mysite works fine from within the server EXSER002.
http://IPADDRESS/mysite works fine
http://EXSER002/mysite fails with authentication.
The site use to work with the hostname prior to Windows authentication.
Even tried ping from local machine to the server and I can ping both the hostname as well as the IP address. Error I get is: You are not authorized to view this page
Do you have a proxy? If so, make sure that bypass is on for local addresses.
Check this link.
http://support.microsoft.com/kb/896861 .
The issue occurs due to the loopback check security feature .you need to make registry setting changes (as mentioned in the link) to get rid of the authentication failures.

ActiveDirectoryMembershipProvider "The specified domain or server could not be contacted."

I have an application that is using ActiveDirectoryMembershipProvider to grant access to users. The application is hosted on a non-domain machine, with a firewall between the application server and the domain controller.
We've opened the LDAP port to the DC on the inside network - yet no matter what we try, we end up with an error that says "The specified domain or server could not be contacted."
Does anyone have any suggestions on how I can resolve this? We've tried everything we can think of and just aren't getting anywhere.
My connection string is:
<add name="ADConnectionString"
connectionString="LDAP://10.5.3.7:389/DC=MyTestDomain,DC=local"/>
And my provider is:
<add name="ActiveDirectoryMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider"
connectionStringName="ADConnectionString"
attributeMapUsername="SAMAccountName"
connectionProtection="None"
connectionUsername="LdapUser"
connectionPassword="LdapPassword" />
The application is hosted on a non-domain machine, with a firewall between the application server and the domain controller.
Since you could query directly using an LDAP tool, that suggests that the firewall is open correctly. However, keep in mind that the ActiveDirectoryMembershipProvider is not using plain old LDAP, it's using Microsoft technologies. For example, if you set connectionProtection="Secure", ADMP will try using SSL and port 636, if that fails, it will use Microsoft's built-in IPSec signing (see this article for more details).
Anyway, this makes me wonder about a couple things:
Does the AD domain have an IPSec "required" policy which refuses connections from non-domain/non-configured computers? (Probably not, since you connected with plain LDAP, but it's worth investigating.)
Have you added the domain controller's NetBIOS name to your lmhosts file, and its DNS name to your hosts file? (Many protocols check that their target's reported name matches the name you tried to connect to.)
A lot of people have noted problems using ADMP between different domains, and the solution required that a one-way trust be created. Since it sounds like your client computer is not in a domain, you can't have that trust--unless either (a) it is a member of a different domain with a one-way trust or (b) it is a member of the same domain and thus client-server trust is implicit.
It seems like the solution is to open port 445.
Read this thread
We're not allowed to open so I guess I'm stuck.
You can use this two articles, may be solve your problem
www.ddj.com/windows/184406424
forums.asp.net/t/1408268.aspx
and check your firewalls
I had this error, and managed to fix it. There are multiple reasons that can lead to this, here is a to-do list to identify exect problem:
Create a micro application, with single method Membership.GetAllUsers(), execute on machine outside Active Directory (AD), with incorrect password in connection string, check if you get incorrect password exception. If you don't get it you can't connect to your AD server, check firewall, if you do get invalid password exception, goto next step.
If you can, try to execute same app, localy on AD server, first with incorrect password, than with correct, executing app locally provides more detailed exception what is wrong (for me this exception lead me to fixing problem). In my case it told me that Server service is not started, than that Workstation service is not started.
Some thoughts on the fact that it required Server and Workstation services to be working on server: afaik Server service is used for windows file sharing (netbios over TCP), and is using 445 port, so it mey be that this port must be opened in addition to LDAP port. My second observation was that event if 445 port opened (netstat -an) it still can be not working, winows will drop all packets to this port if Windows Client and File and Printer sharing checkboxes are not checked on network interface adapter which rcived this packets. Check "telnet External_IP 445". Thats all info i gathered while strugling with this problem.
Have you tested with an LDAP browsing tool, from the remote box to see if it can connect with the criteria being used here? I.e. Is it a connectivity problem or something else?
In case anyone stumbles on this and wants to smash their head on a wall... Recently tried doing all this for an AD server that my company had in a different domain than the current context. Was using the IP provided and getting failures as stated here. Even used a tool like Softerra LDAP Admin and it worked fine, however AccountManagement failed.
We had a publicly exposed URL hooked to that IP address (still only allowing certain IP's to make calls). Once I replaced the IP with the URL provided, it worked like a charm.
Hope this saves someone the hours of head smashing I just put myself through.

Resources