host.docker.internal didn’t send any data for WebStatus endpoint - c#

I am trying to run https://github.com/dotnet-architecture/eShopOnContainers locally. I managed to setup all the 21 containers in my Docker Desktop and all the 21 containers are running.
But when I try to access to http://host.docker.internal:5107/ for WebStatus endpoint, I got this error. I have also run both powershell scripts at deploy/windows folder.

host.docker.internal is for docker internal communication mainly - not external connection to container (for example from localhost). You can open any container in docker desktop and try clicking browse web (if applicable) or as suggested above in comments use localhost:5107
A little background from docker documentation:
I want to connect from a container to a service on the host
The host has a changing IP address (or none if you have no network access). We recommend that you connect to the special DNS name host.docker.internal which resolves to the internal IP address used by the host. This is for development purpose and does not work in a production environment outside of Docker Desktop.
You can also reach the gateway using gateway.docker.internal

Related

What is the best way to debug an app deployed to Kubernetes locally using Docker Desktop?

I have experience using Docker to develop a relatively complex application. It is very easy to debug an app using Visual Studio (2019). I just set docker-compose.yaml as the startup app and start debugging.
Is it possible to debug an application that is published to Kubernetes locally using Docker Desktop? By debug I mean set breakpoints etc? I have spent a few hours Googling this and I have got nowhere and hence the reason for the question.
Please note that I am not asking how to debug an app that is published to Kubernetes in the Cloud e.g. Azure - there are plenty of webpages that explain how to do that.
Assuming the image uses a Java CMD, include the standard debug JVM arguments (What are Java command line options to set to allow JVM to be remotely debugged?), then expose the debug port when running a container, and in IDE set up a remote debug session on that port once the container starts up.
Telepresence may be a very good fit for you.
Using telepresence you can debug your Kubernetes service locally, using your favorite debugging tool. So it doesn't matter where your K8S cluster is.
Take a look on this tutorial to check how it works.
HOW IT WORKS:
Telepresence substitutes a two-way network proxy for your normal pod
running in the Kubernetes cluster. This pod proxies data from your
Kubernetes environment (e.g., TCP connections, environment variables,
volumes) to the local process. The local process has its networking
transparently overridden so that DNS calls and TCP connections are
routed through the proxy to the remote Kubernetes cluster.
you can stdout docker logs , use kubectl logs pod_name -n namespace_name

Do I have to install Docker on the remote host, in order to access my application online?

I have bought a space from a host service already and published my files into it and it is currently running successfully.
Now, I have started to learn Docker and use it's advantages like Containerize. I would like to have several instances of my application running on the remote host, in order to achieve this I need several Containers that are using the same image(my application). In order to achieve this I have created an Image and Containers and pushed them to DockerHub, no I want to pull and download them on the remote host, in order to see the Containers via their online address. Now my question is, do I need the Docker to be installed on the remote host? If the remote host is not a dedicated server but the shared one, do I need to install the Docker on it still? Or there is any other way that I am not aware about?
The project is SPA (ANGULAR + ASP.NET WEB API + SQL SERVER)
Yes, you have to install Docker on your remote host in order to run your image.
If the remote host is a shared one, though, chances are that you are not allowed to install Docker there for security reasons. If you're allowed to run Docker containers on a host, you have effectively root access.
EDIT
Since the question about "effectively root access" came up:
Supposed you're on a shared hoster where each user has its environment under /home/user. Now imagine your user can run Docker commands, i.e. is in the docker group.
You could simply run docker run -v /home/anotheruser:/iamaspy alpine and you could access another user's content in the container on the path /iamaspy. Have a look at the docker docs for further information. Here you can also find a more elaborate SO answer than mine.

Configuring url IIS 8

I'm configuring an IIS 8 Server, and here is the schema that I'm thinking.
I need two environments
Homolog, is the first and will be a server for applications homologation. Runs at port 8585.
Production, is the production site, and applications running here will be configured under a DNS, and a specific domain. Runs ant port 8080.
Inside ineptup/wwwroot folders I have this structure
I want to access applications under homolog's environment with:
Http://< ip address >:< port >/homolog/< appName >
I want to access applications under production's environment with:
http://< ip address >:< port >/production/< appName >
mydomain.net
So, how can I configure it at IIS 8?
Normally IIS Default Website(which is pointed to inetpub folder) will run on 80 port, You can override it.
If you want to have different ports for your sites
Create website by right clicking on sites, give appropriate path and port number in below window
Give site name(this can be any name just to identify your site in IIS)
Physical path
Port Number
While creating sites check the application pool, it should target to your framework
For domain you have to give host name, before that you have to map your server with DNS provider
This link will guide you through the steps

Accessing Azure Emulator from Another Device

I Have two different projects:
Windows Phone 8 Application, which I am running on a real, physical development device.
Azure Cloud service, which contains one simple WebRole endpoint that contains a ASP.NET MVC WebAPI.
My goal is simple:
Use the WP8 Application running from a real device, to access (using HTTPClient) the WebAPI controller while it is deployed to the Azure Emulator.
What DO work is:
The application can successfully communicate with the WebApi when it is deployed on Azure Cloud.
The application can successfully communicate with the WebApi when it is hosted locally on IIS Express (Without Azure), and the IIS Express settings are changed following this article.
As far as I understand, the problem is that the Azure Emulator is configured to listen on IP address 127.0.0.1, which is not accessible from outside the localhost domain.
I found this post that offers a solution to this exact problem, but trying to follow it results in an Unknown Exception while trying to deploy to Azure Emulator.
Is it really impossible to locally test WP8 application that communicates with Azure Cloud Service?
I figured out how it is possible to have a Phone Emulator or an attached physical Windows Phone device communicating with the Azure Emulator.
For other developers struggling with the same requirement, here are the steps required for it to work:
Assumptions:
You know the IP address of the hosting machine.
No Firewall is blocking the access
Shut down IIS and Azure Emulators and restart them after configuration changes
Azure Compute Emulator:
Open "C:\Program Files\Microsoft SDKs\Windows Azure\Emulator\devfabric\DevFC.exe.config" for editing.
Set "VipPoolStartIPAddress" and "VipPoolEndIPAddress" to your hosting machine IP (e.g. 192.168.1.100)
Azure Storage Emulator:
Open both "C:\Program Files\Microsoft SDKs\Windows Azure\Emulator\devstore\DSServiceLDB.exe.config" and "C:\Program Files\Microsoft SDKs\Windows Azure\Emulator\devstore\DSServiceSQL.exe.config" for editing.
Set the services section in both of the files to use hosting IP.
Configure the Storage Connection String in the "Role" settings (instead of default Windows Azure storage emulator setting):
Right click on the Role (under "Roles" folder in the solution explorer) to enter it's Properties page. Click on Settings tab. Make sure you edit the Local settings (Select it on Service Configuration selection box).
Edit the Connection String for the storage
Manually enter credentials
Account name and account key are written under accounts section in DSServiceSQL.exe.config
Specify custom endpoints, with your hosting IP.
Enjoy!
You don't need any external app to do this. Try port forwarding using the following:
Run your application in Azure emulator and then find out its IP and Port by right-clicking the IIS Express icon in the system tray (say 127.0.0.1:81)
Now choose a port to listen to (say 8088) and forward its incoming requests to your application by simply executing the below command in an elevated command prompt:
netsh interface portproxy add v4tov4 listenport=8088 connectaddress=127.0.0.1 connectport=81 protocol=tcp
If the firewall is running and your chosen port is blocked, then open the port (8088 in this example) by adding an inbound rule to Windows Firewall.
Now browse using your Computer IP, like 192.168.0.100:8088, and now you should be able to access your application. And this can be used through your WP or Cordova (mobile) app to test locally. Hope this helps.
(If you want to remove the port forwarding, then just use the delete switch of the netsh interface portproxy command.)
I know this has already been answered, but there hasn't been a simple solution to this problem posted yet. Here is what I did to get my Mac talking to my Azure Storage Emulator(v4.3) running on my PC all over my LAN.
I'm running Windows 10 Version 1511 with v4.3 of the Azure Storage Emulator at time of writing.
Make sure the Azure Storage Emulator is off. You can do that by opening up the Azure Storage Emulator command prompt. You can find it by typing Azure Storage Emulator into the Start menu. Once it's open, type AzureStorageEmulator stop.
Grab the computer's IP address that is running the Azure Storage Emulator. Type ipconfig into the command prompt you already have open. Find the IPV4 Address - should be something like 192.168.1.xxx
Open the file located at C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe.config
In the StorageEmulatorConfig section, edit each service so that it looks like below. Obviously replace the "xxx.xxx.xxx.xxx" with your actual IP address... But keep the ports the same!!!
Next, head on over to your firewall settings. We'll need to allow inbound connections to your computer's IP address to these the three ports listed above in the StorageEmulatorConfig section. Under Control Panel -> System and Security -> Windows Firewall -> Advanced settings -> Inbound Rules, click New Rule... on the right side of the screen. You'll be run through a wizard to set up a new rule. I'll outline what to do below:
Rule Type: Select Custom
Program: Select Customize... then Apply to services only
Protocol and Ports: Set the Protocol type to TCP and set the
Remote port to Specific Ports and in the input box enter
10000-10002. That will add the range of ports specified in the
StorageEmulatorConfig section to this rule and in turn allow
incoming connections through those ports.
Scope: Skip this section, have it apply to all IP addresses for
simplicity sake
Action: Allow the connection
Profile: Depending on what connection profile you are running on, you
should select the appropriate one. In my case, my computer was
connected to the LAN in my house, so I was connected to a Private
network. I deselected Domain and Public. I would recommend doing
the same.
Name: Azure Storage Emulator
Hit finish and you're done!... with that part...
Open an Administrator elevated command prompt and enter the following commands (Note: replace the xxx.xxx.xxx.xxx with your IP address!!!):
netsh http add urlacl url=http://xxx.xxx.xxx.xxx:10000/ user=everyone
netsh http add urlacl url=http://xxx.xxx.xxx.xxx:10001/ user=everyone
netsh http add urlacl url=http://xxx.xxx.xxx.xxx:10002/ user=everyone
Open a browser on the device where you are trying to connect to the Azure Storage Emulator and try to access the following URL's:
http://xxx.xxx.xxx.xxx:10002/
http://xxx.xxx.xxx.xxx:10002/
http://xxx.xxx.xxx.xxx:10002/
If you get a response back that's something like this:
InvalidUriThe requested URI does not represent any resource on the server.
then you're golden... If not, post a comment and I'll update my response.
It's important to note that you must update the connection string in the .config file of the project where you are generating the urls to access your images (assuming that's what you're doing). YOU MAY NO LONGER USE THE DEVELOPMENT CONNECTION STRING SHORTCUT! It must be updated to: (replace the xxx.xxx.xxx.xxx with the IP address from above:
DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://xxx.xxx.xxx.xxx:10000/devstoreaccount1;TableEndpoint=http://xxx.xxx.xxx.xxx:10002/devstoreaccount1;QueueEndpoint=http://xxx.xxx.xxx.xxx:10001/devstoreaccount1;
If you have this in your AppSettings section and you format it nicely with \n's, you'll break the string and the Storage component won't recognize it as a valid connection string. So keep it one long annoying string.
Since you're already using (regular) IIS and you claim that it works, you can use Server Farming as some kind of a Reverse Proxy + Load Balancer to achieve your goal:
Run your WebRole project and save the internal Urls (as appears in the image 127.255.0.2:82).
Open IIS Manager > Server Farms > Create Server Farm.
Choose a name and click Next. in the next panel ('Add Server') add all the Urls you gathered in step 1 and Finish.
Click Yes when asked if you want to create the appropriate Rewrite Rules for this Farm.
Under Server Farms list, click on your new Farm and choose Proxy from the icons on the right, check the Reverse rewrite host in response headers checkbox.
You can now use your regular IIS binding address to access the Emulator instances (once running).
P.S: If you want to reverse this changes, delete the Farm. then click on your computer / server name (root item) in the left tree, choose Url Rewrite on the right, and delete ARR rules.
I have found a way, thanks to this great post here.
Apparently, by re-routing any traffic sent to the my local IP address (e.g. 192.168.0.1) to 127.0.0.1, I am now able to use Windows Phone 8 Emulator against Azure Cloud Emulator instances.
The way I did the routing is by using a simple app named PassPort, but I assume that there are many alternatives to it.
It's recommended to use port forwarding because of the instability of Azure Emulator. However, it doesn't work when connectaddress is 127.0.0.1 using the built-in tool netsh on my windows 7 (see for detail: problem with adding a portproxy using netsh). I search and find PassPort port forwarding utility Win XP to help me with port forwarding.

Remote Debug with Amazon Web Services (EC2) and c# Windows Service/WCF

I have a Windows Server 2008 R2 in the Amazon EC2 cloud. I would love to be able to debug my C# Windows Service or WCF Service that is running on that server from my desktop in my office.
In the past we got around it by installing Visual Studio on the server in the cloud, but we use remote debugging for our local servers, so I was hoping there was a way to make it work in the cloud.
Has anyone out there accomplished remote debugging to the Amazon cloud without a VPC/Domain in the cloud?
Any suggestions or solutions would be most appreciated.
There isn't anything different about remote debugging against an EC2 instance than there is about remote debugging against a local server EXCEPT firewall configuration...
I would recommend setting up a VPN connection to the EC2 server instead of opening up firewall ports (PPTP is quick and easy).
If you would rather open firewall ports I "think" you will at least need the following (untested):
TCP 139, TCP 445, UDP 137, UDP 138 (all related to DCOM)
Another thing that always causes issues for me on EC2 instances is not passing the /hostname parameter to msvsmon. msvsmon likes to default to the internal hostname and will startup showing something like "listening on 'ip-1-2-3-4.us-west-2.compute.internal", which means it will ignore attempts for connections from Visual Studio clients that think they are talking to 'ec2-7-8-9-0.us-west-2.compute.amazonaws.com'. To fix this, get the full public DNS name or public IP of your EC2 instance and then launch msvsmon.exe as:
msvsmon.exe /hostname ec2-7-8-9-0.us-west-2.compute.amazonaws.com
Then in Visual Studio:
Tools-->Attach To Process
Set Transport to "Default"
Set the Qualifier to whatever you passed for a hostname when you launched msvsmon.exe

Categories