Cannot access ASP.NET Core Web API from Windows-based Amazon virtual machine - asp.net-core

I've been searching Google and StackOverflow about this for several hours now, and nothing seems to work.
I created a Web API server in ASP.NET Core and verified it works locally.
I created a new EC2 VM to host the Web API. I copied all the binaries for the API up to EC2, and started the server from the command line.
I have made sure that the required EC2 security group exists and that the correct TCP port is open for Input in the security group.
I have added an appropriate firewall rule to Windows firewall.
NETSTAT -Q shows that the server is working and that the port is in LISTENING mode.
I get the public IP address for my EC2 VM and go back to my local machine.
I use POSTMAN to submit POST requests to the EC2-based server.
POSTMAN returns an error: "There was an error connecting to ...."
So I'm at a loss as to what to do next. Have I missed some EC2 configuration? Is there something else I have to do to the ASP.NET Core WebAPI code?

Related

Asp.net core application is not accessible from an external load balanced Azure VM

I have created a VM behind an external load balancer in Azure and I am using IIS as the reverse proxy webserver to host the asp.net core application.
I am able to access the application inside the VM using localhost but not able to access the same from my client machine through the public ip configured for the loadbalancer.
I have configured loadbalancing rules for incoming traffic on port 80 and port 443 for the loadbalancer and specified appropriate NSGs for those ports.
Before deploying the asp.net core application I was able to access the defaultwebsite from my client machine. so I assume that inbound rules are taken in to account and working fine.
This is a self contained application and since I am able to access the application inside the VM through localhost I assume that the aspnet hosting module and other configuration required is proper.
Please let me know if there is anything else I can be missing.
I guess i have figured out what the issue is.
The Loadbalancer probe for the application is configured to be Http since its a webserver and is instructed to check at the default path "/" and since the application i have created does not serve anything on "/" its considering the node as unhealthy and does not respond or serve anything.
I changed the probe to tcp and it works just fine.
Thanks,
Teja

I don't get data from remote service

I have a service, hosted in a windows service. When I installed the windows service in the local machine, I can get data from the service, but when I installed the windows service in the remote computer (in the server), I don't get data.
I have tried in a internet browser to use the address of the endpoint in the server, and I get response, so I get the page that says how to use svcutil to create the proxy.
Although I get this page, I have tried to disabled the firewall in the server and in the client, but the problem persists, how I expected.
If I get response in the internet browser, wouldn't I get access to the methods of the service?
On server side add trace listener so as to find out what error occures. Do you make use of any certification which service may not possess?

Hosting website on Azure Virtual Machine

Yesterday I created an Azure Virtual Machine using the simple Win2008r2 + SQL2008r2 image.
I have deployed a website to the VM via an RDP session.
I am able to browse the website locally (via RDP) using
"http://localhost"
I understand that I need to add an Azure endpoint for port 80 to enable me to browse to the site from an external machine.
I have configured the Windows Firewall on the Azure VM to allow traffic on Port 80 inbound and outbound.
Could anyone please advise what I've missed or what I can do to troubleshoot?
---Update-----
I have learned a little more this morning. The website that I'm trying to host on the VM is an installation of Interwoven Teamsite v7.3.x. When I looked in IIS I could see that the "Default Web Site" was stopped. Another website called "TeamSiteSitePubPreview" had been created but was only bound to port 81.
So, what was presenting the website I could see when I browsed to
http://localhost locally?
I ran netstat -ano and this showed me that PID 1604 what listening on port 80. I then ran Process Explorer which told me that PID 1604 was allocated to "Appache HTTP Server".
I know nothing about About Appache, can anyone tell me if there's some Apache config that will be preventing connections from outside of the local server?
For reference, I just tested this sequence and it gives you a website accessible over the Internet:
Create a new Windows Azure virtual machine with the Windows Server 2008 R2 SP1 image.
Add an endpoint on public port 80, private port 80.
While the endpoint is being created, start setting the server up.
Remote Desktop in.
Add the Web Server (IIS) role with default settings.
Test the connection. You should get a HTTP 200 OK status.
If you want to troubleshoot your server, start checking for errors in the event log. Check also the website bindings in IIS (Port 80, IP Address *).
Also consider the connection issue might be on the client (your) side. For instance, DNS caching. Try connecting from another machine with direct Internet connection (such as another cloud server) or from a service such as isup.me.
Additionally, if all you want is to host websites in IIS, the Web Sites service has a more streamlined experience.
You will need to create an endpoint on port 80 thru Windows Azure Management portal as well. This endpoint opens a port in the Windows Azure Load-balancer.
Navigate to your VM within the portal and create a new Endpoint under the Endpoints screen of VM configuration within Azure management portal.

Microsoft Azure Apache Web Server Not Accessible

I've created literally dozens and dozens of web servers in my day, but this is my first attempt with Windows Azure and I'm running into some problems. I just started migrating from AWS recently.
First of all, I'm running Ubuntu 13.04. Firewall disabled (for debugging), Apache2 installed correctly (using apt). SSH works fine as do many other services with both the DNS hostname and public IP. Virtual host is set up correctly and validated. However, I cannot access the HTTP website either through the Azure provided subdomain or the virtual IP. It just times out.
This is also my first time using Ubuntu 13.04 as well. So, through the powers of deduction, I'm assuming there is something I'm missing either with this new version of Ubuntu or some quirk in Azure. Does anyone have any suggestions?
SOLUTION
These steps to create "endpoint" works fine for all VPS:
open "virtual machine > endpoint > add endpoint"
choose "next"
set "name:http, protocol:tcp, public port:80, private port:80"
choose "complete"
and then must wait for activation and then for some time.
If you are using Azure Resource Groups along with your VMs (which is available on the new portal) you cannot use endpoints because it's not available there, so you should follow the following to open up the HTTP port or ANY other port:
1- Select the VM that you want to manage ports on.
2- In settings, click on Network Interfaces and select your network.
3- Go to Network Security Group and select your group.
4- Add Inbound or Outbound security rules depending on what you need.

Debug Windows Phone 7 application that contacts locally hosted WCF server

I've built a WP7 application and a locally hosted (on my machine) WCF server in my solution. I have debugged it using the emulator and it works fine, however, when I debug via device and try to connect to the server I get an exception stating that the EndPointNotFound (I'm aware I haven't set up anything to catch this exception!). Is there anyway to connect to a localhost server via the device?
Many thanks
Jonno
If you are trying to connect to your local machine from an actual device and it si not tethered, make sure that you are connected to the same local network.
What is the host name you are using to try and connect to the host machine? The emualtor will be able to resolve "localhost" to the host mahcien but your phone won't. You'll need to use the appropriate host name or IP address.
Download and install the Visual Studio SP1 tooling and host your WCF services using IIS Express. This webserver accepts incoming connections from other computers on your local network as long as there's a firewall exception to allow the connection.
You'll have to connect to the machine hosting the service through it's external IP. That cannot be localhost or 127.0.0.1 (it has to be something belonging to the same subnet).
Scott Hanselman had a presentation about the "MS Web Stack of Love" where he demos how to set all this up (using HTTPS even) and it goes into depth about how to configure the firewall and all that jazz. I recommend watching it, as he is also, a funny guy.
You can use a Wifi connection on WP7 and the local ip of your server in the config file to reference your WCF server ?