Local Service Fabric with VPN on not working - c#

I have a local Service Fabric cluster with 1 node that doesn't work properly when VPN is turned on. I have a catch 22 where I need the VPN to connect to external services while running the cluster in debug mode.
It'll work if I start the cluster without VPN, then after the cluster is started, turn on VPN. This works for some time but as soon as I spin down the cluster (i.e. when I need to re-compile/debug) it won't start back up.
Is there a way to have the VPN turned on where I can spin up/down the cluster like I would in any other normal application development?

There are 3 options.
Disbale the service fabric DNS service, if you are not using service fabric dns I would suggest this.
Use alternative DNS
Reset your DNS settings after connecting to the VPN and Add all the DNS IP mappings in your hosts file.
Option 1
Change your local cluster config. Your clusterconfig is located under: C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup
So if your dev cluster is single node unsecure, you can change: C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup\NonSecure\OneNode\ClusterManifestTemplate.json
In the "addOnFeatures" tag you can remove "DnsService" example:
"addOnFeatures": [
"DnsService",
"EventStoreService",
]
After these steps you can reset your dev cluster from the system tray. (Right click the service fabric icon => Reset Local Cluster)
You can verify if the DNS Service is disabled in Service Fabric Explorer:
Option 2
Open the properties of TCP/IPv4 of your current connection (via Control Panel\All Control Panel Items\Network Connections)
Change the prefered DNS to the one service fabric is using before connecting with the VPN
Put the first DNS of the VPN in the Alternate DNS server textbox.
Option 3
Connect to the VPN
Find all IP adresses of the FQDN's you need. (You can use ping in command line)
Open C:\Windows\System32\drivers\etc\hosts
Add all ip FQDN mappings (1 per line). example: 1.1.1.1 your.company.com
Change your DNS settings to your default configuration.

Related

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

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

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

How to access website on client machine?

I created management information system for school in MVC 4 which is role based system and configured it on server though IIS. It works fine on single machine (server).Now i need to share that application on LAN network without internet. I have no idea about how to share this to client system.I read many of tutorial but that didn't help me anymore.Please help me i spent lot of time on this issue but got no solution. Thanks in advance.
1.Check the IP address of system in which you hosted the application: eg: 10.0.1.12
2.Replace the localhost in URL with the IP address.
ie http://localhost/YourApplicationFolder
http://10.0.1.12/YourApplicationFolder
3.Add an inbound rule in firewall, for port 80.
4.Now try to access your website from another system with http://10.0.1.12/YourApplicationFolder
setting inbound rule.
1.go to Control Panel\System and Security\Windows Firewall
2.select Advanced settings from left.
3.select Inbound rule from left.
4.Select Add new rule from right.
5.select port and Next.
6.Select TCP and special port specify 80. Next.
7.select Allow the connection.Next.
8.select Domain,private,public.Next
9.Add some name and description.
10.finish
you have to set this in server.
Place your Application folder in C:\inetpub\wwwroot
Open IIS and navigate to Your-PC > Sites > Default Web Site
Right click on your Application folder and convert to application
Now check your IP Address on other system browser if its not showing your IIS page then turn off your PC firewall and now you can access your application any system within LAN
Your URL will be Like http://192.168.1.1/AppFolder/
Thats it.

Fail to reach WCF Data Service over LAN

I created an ASP.NET WEB project in VS2012 and add a WCF Data Service file(.svc).When i run, i can reach it(localhost:61388/default.svc), but i can't reach it in another computer by typing my host's ip address(192.168.1.4:61388/default.svc) and it shows BAD REQUEST-INVALID HOST NAME.
Then how can I reach my wcf data service from another computer?
I've turned off all firewalls and my os is windows 7 Pro
For that you need to host your WCF service in IIS server...To learn more about IIS server and add website see this
BY default there is a default website running at port 80.(You can check by typing http:\localhost) If you dont get anything that means IIS is not installed in your PC.
Once your IIS is up and running add your WCF service to IIS just like you add website to IIS (Or directly publish your WCF service in IIS publish-->IIS) and give it a specific port number (lets say your WCF service is running at 81).you can access the service from other computer (Lets say the PC which host has ip 10.20.50.121)...then you can access it on another computer by typing 10.20.50.121:81.
Now to connect your WCF service to Website,you need to check if your wcf service is running or not.For that when you publish your wcf service to IIS you get 3 files out of which one is default.svc(or any of your name you can click on the service go to contents view and see it) click it and on the right hand side click browse if you see a success page that your service is running then you need to copy that address an paste it in your Website webconfig endpoint address location and change the appopriate dns value .That should get your WCF service started
can you access it from your own computer using 192.168.1.4:61388/default.svc ? Or only localhost ? Run netstat -a and check the webserver is actually binding to the 1.4 address and not just to your local loopback adapter (127.0.0.1).
Create a virtual directly pointing to folder where your wcf svc is lying and try accessing it.

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.

Categories