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.
Related
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.
I've got a web application for our office use only. In my office I've got 12 computer and want to install one pc and access via web browser from all computers. I can run web application on visual studio but couldn't find a proper way for all computers and kinda new in this area.
I would like to access on browser like "myapp.com" or localhost something else. Is that possible to give specific name and access even on mobile phones?
Thanks in advance for all suggestions.
You can host your application using IIS. IIS can be setup in any machine.
Steps :
Install IIS
Open IIS manager by entering inetmgr in Run(win+R)
Add website by browisng to its location to the published website location. (Hope you know how to publish a website in visual studio)
Edit the web config file to configure the sql server credentials(Sql db could be hosted separately or in the same machine)
Right click the website in IIS Manager and click start.
Click browse to view the website
You could either access the site by localhost:portnumber or by specifying IP:port number in settings of the website in IIS manager
You can access the website from mobile or external devices if you select public IP for your website. Incase you're connected to a local network, then the website could be accessed only from within your work place. Discuss with your network admin about exposing your server to public by providing a public IP address, if you're on local network.
Feel free to revert if you have more doubts.
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.
I want to redirect URLs entered in the browser. For example, when I enter http://microsoft.com, it would redirect to http://127.0.0.1:5000/webpage.html and show this page. I want to do this for all websites entered in the browser.
I don't want to do it by ASP.NET.
I have 10 computers in a workgroup network. I want to manage them by a system that it is server.
My program has 2 client and server versions. Client versions install on PC Clients.
I want to be able to get the client bandwidth systems, And if the bandwidth is over, I redirect browser to a page or port (127.0.0.1:32500) and I stop communicating with internet for all programs on PC Clients. I know that I use proxy, but how?
If I set proxy for browser, other programs can connect to Internet without cross through the proxies.
I want to make a program like net support schools that I can control internet on client (Web access in net support).
I would do this by creating entries in the Windows HOSTS file (C:\Windows\System32\Drivers\etc\hosts).
This is a permanent redirect until the hosts files is changed again.
Also, please be aware that Windows maintains a DNS cache, so if you use something like this, you may have to tell windows to flush it's DNS cache. That can be done by using the command:
C:> ipconfig /flushdns
if you have 10 computer,
1-it's better you put a server like one of them and on the server start dns server like 192.168.1.1 and manage all site and ip you want and for clients set dns on you dns server.
2-it's easier, but if your network bigger you can't administer that. You must open every client hosts file (C:\Windows\System32\Drivers\etc) and add row like
127.0.0.1:32500 microsoft.com
if you want change this file you must run as administrator.
I am still experimenting with Azure multi tenant development. I now have my first trial thingy, but in order to use subdomain names (customer.site.com) I need to switch my Azure website to shared/reserved. Since I am still experimenting, I rather not start paying for Azure. Is there a way around this? Or, is it possible to test the multi-tenant part in my local visual studio webserver?
No, you can't have custom domain names with FREE websites.
But what you could do, is to switch the tenant recognition from sub-domain to a path. So instead of having tenant10.site.com/ you would have mysites.azurewebsites.net/tenant10/. That would basically be just a change in URL Rewrite rules - which I think is the right way to handle multi-tenancy recognition at URL level. And URL rewrite is supported in Azure WebSites as well Azure Cloud Services.
Testing the multi-tenancy locally is even easier. You just open your hosts file (in a typical windows installation it is located in c:\windows\system32\drivers\etc\hosts. Just add entries for all (sub)domains you want to test, and map them to 127.0.0.1. Something like:
127.0.0.1 tenant1.mydomain.com
127.0.0.1 tenant2.mydomain.com
127.0.0.1 tenant15.mydomain.com
...
Then, run your project with F5 like you would normally do and manually type in the new address in browser's address bar: tenant1.mydomain.com.
However first launch the project with F5 to check the real IP address of local development fabric, because sometimes it may not be 127.0.0.1, but 127.0.0.8 or something else. The IP address that is used in your browser's initial launch is the IP Address you have to fill in your hosts file.
However, if you work with real (sub)domain names in hosts file, do never forget to remove the entries from it, as you will never reach the real Internet sites.