Cannot connect (via http) to IIS app on Azure VM - http

I have created a SQL VM on Microsoft Azure and it's been like a walk in the park:
I was able to connect via RDP all the time. I installed an app to IIS and it was working ok.
Now, i wanted to connect from the outside world, but Chrome just gives me the page is not available error.
My DNS name is sqlmilos.cloudapp.net.
I took down windows firewall on windows server.
IIS is bound to port 80.
As I understand I connect to my VM via cloud service which was created at the same time as VM, and it has same dns name: sqlmilos.cloudapp.net
That cloud service has 2 input endpoints (shown in dashboard):
SQL : 23.102.171.184:5986
SQL : 23.102.171.184:63907
That 63907 port is for RDP and it's working, obviously.
I thought maybe I should bind IIS to 5986 port, just for test, but iis says that port is already used.
So, I was hoping that somebody could give me some pointers how to resolve this.
Best regards,
UPDATE:
I just realized that you can add you own endpoints to VM, so I added one for port 80, so now I have 3 ports open: 80, 5986 and 63907,
but I still cannot connect to application.

Related

Unable to call ASP.NET Web API hosted on IIS 10, Windows 10

I have created ASP.NET API endpoints on my Windows 10 PC, hosted on IIS. Using Chrome's extension app, Postman, I could call the API internally within the same machine (using localhost and even my own local IP). Example:
http://localhost/UserService/api/user/getByUsername?username=abc
and
http://192.168.0.160/UserService/api/user/getByUsername?username=abc
Then I tried using another PC (Windows 7) to connect to the same Wifi LAN that my Windows 10 PC is connected to, and attempted to call the above example URL via Postman, but it did not get through (getting "Could not get any response"error). The Windows 7 PC could not call API hosted on Windows 10 PC.
However, when I reversed the setting ie to host on Windows 7's IIS (version 7.5) and used Windows 10 PC to call instead, no issue found.
What went wrong?? Is it due to some Firewall settings?
A few things to check in Windows Firewall with Advanced Security:
Have you enabled the World Wide Web Services (HTTP Traffic-In) rule
in Windows firewall exceptions?
Do you have any entries in the Remote Computers tab?
Is the action Allow the connection?
What is the content of your Advanced tab like?
EDIT
Based on your comments, the issue is indeed a firewall issue, but not Windows Firewall with Advanced Security. McAfee firewall is blocking external access to port 80. Add an exception to McAfee to allow port 80, and possibly 443. Consult McAfee's knowledge base.
With great help from #reckface, the root cause is found, which is in fact the McAfee antivirus itself. After exploring around the UI, I found the setting to allow incoming traffic for certain port(s) without needing to turn off firewall setting entirely.
With "Web Server (HTTP) Port 80" enabled on the UI, I can now access API's from another PC.

Azure SQL - localhost can't connect

I started coding an ASP.NET webapp (with Visual Studio 2015). I'm having problems with the connection to my Azure SQL database. I can connect to the database via MSSM Studio.
When I publish my app on the Azure webservice the app works fine. When I run my code locally I keep getting the following error:
SqlException: Cannot open server 'database' requested by the login. Client with IP address 'XX.XX.XX.XX' is not allowed to access the server. To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range. It may take up to five minutes for this change to take effect.
Altough the firewall of the database service is set (I've even tried with range 0.0.0.0 too 255.255.255.255). On my computer port 1433 is allowed.
Any help is deeply appreciated.
The problem was solved by editing the username of the database connectionstring.
my_username#my_app.database.windows.net -> only worked published on Azure (not via localhost)
my_username#database.windows.com -> works published on Azure and with my localhost

How to access ASP.NET app from another pc on the same network?

I'm running a ASP.NET on my pc and I would like to access to that app from another pc on the same network. I've tried to reach the app writing the URI of my pc on the network followed by the port number as below:
"192.168.X.X:49223/"
But it shows me an 400 error saying that it's an invalid hostname...
Is there something to do with my windows firewall or in IIS to allow access from another PC ?
Thanks for your help.
You may need to an exception in Windows Firewall.
Control Panel > Windows Firewall > Advanced Settings > Inbound/Outbound rules.
Add a new rule to both, specifying your port number and a generic name to identify its purpose.
Install IIS server on your machine, then deploy your application on that IIS server.
Refer this for Deployment assistance
To run the application on IIS instead of ASP.Net dev server you need to
Right click on solution in VS
Click on Start Options..
In Server section, Select "Use Custom Server" and then provide the URL of the application you have added earlier on IIS
Then you can easily access your website from any other machine on the same network.
Is it hosted in iis, or are you running it through Visual Studio. The funny port number (49223) tells me it's the latter.
When you run a VS project, the dev server is designd to only allow local conconnections. If you connect from a network it gets blocked by design. Their is no config around it.
What I do as a hack is run a reverse proxy like Nginx. It's a free download. Run it on your dev machine. You can tell it to listen on a port (eg 88) and then redirect tge traffic to port 49223. Give your mate the same url as before but replace the port with 88
Nb make sure your port 88 is open as per codemans answer
An example of the nginx config would be https://gist.github.com/ekinertac/5524389
This then tricks VS into thinking it came from your local machine.

azure connect between azure myWebRole and nonazure server not working

My webapplication hosted on windows azure, needs to communicate with TFS Server. When any one login to my web app using live id, I want the logged in user to use my Team foundation server(TFS) credentials -username,password and domain to programatically authenticate and connect to our TFS server and create some work items.
I configured my azure connect for the communication to happen between azure WebRole and TFS server (our TFS is non-azure ).I added both the WebRole and the TFS Server into single Connection Group
In my azureportal ,I can see mywebrole and my TFSServer as connected the machine endpoint is active, and that it refreshes since the last connected updates
.But when I try to run my web application from azure and when it tries to communicate with our TFS server ,its throwing error message saying Error message : Team Foundation services are not available from server eg.,http://xyz-abcxyx-01:8080/tfs/eas/. Technical information (for administrator): The remote name could not be resolved: 'xyz-abcxyx-01'
Any suggestions to resolve this issue ?
You should enable remote desktop on your WebRole and connect to one of your instances. Then, try to ping the IP of your TFS server (not the hostname xyz-abcxyx-01). Maybe this is simply a DNS issue (even though using hostnames works with Windows Azure Connect).
If pinging the IP works, but pinging the hostname doesn't work you have a few options left:
Use the IP instead of the hostname. This won't work if you configured your TFS to use host headers.
Create an elevated startup task to modify the hosts file and map the IP to the hostname. In your code you can keep working with the hostname.
Try to modify the DNS server configured in your WebRole to use the default DNS server + your internal DNS server. But to me this doesn't look like a clean solution.
Anyways, in each solution you'll want to store the IP/hostname in the ServiceConfiguration and make sure your code supports changes to the ServiceConfiguration. This will allow you to change the IP/hostname without having to redeploy.
You should check if TFS server is listening on all network interfaces, include the one created by Azure Connect (start with 2a01). Next try to connect to TFS from a machine on the local LAN, just to make sure it is configured correctly. You don't need to use IP for referring to TFS, DNS name is definitely supported out of box.

Accessing remote web application using LogMeIn Hamachi2

I am trying to remotely access a web application hosted on the office LAN.
I have setup LogMeIN Hamachi and I can connect to an office machine and see shared resources (folders and printers) on that machine.
I selected a Hub-and-spoke network and made the machine with the web app the hub.
While in the office I type http://192.168.1.6:8080/mituz_oc in my browser to get access to the web app.
However, when I try to do the same remotely I get the message "Firefox can't establish a connection to the server at 192.168.1.6:8080."
So I see that the IP address to the computer I have VPN-ed to is 5.14.212.196 and so I try to gain access to the web app by replacing the office LAN's IP with the Hamachi IP (I can only post one hyperlink hence the verbose alternative )
I get the same error message as before, only this time with the HAMACHI IP address.
I can access all the shared resources but can not access the web app.
Is it possible to do what am attempting - remotely access a web application on office server?
If so what am I doing wrong / not doing ?
TIA.
Clemens
1) Check if your Windows Personal Firewall setting blocks connections from Hamachi's 5.x.x.x IP address ranges.
2) Check if your Web Server listens on 5.x.x.x. You can find it out by this command:
netstat -na
Look for local address of "0.0.0.0:8080" which is in the state of "LISTENING".
3) Replace Hamachi with different VPN provider, like www.remobo.com
(Disclosure: I work for the Remobo team)

Resources