IIS and VS, How do they work together? - visual-studio

I'm a bit confused.
When I type in my browser a "local" address (of a web site I'm editing on VS), IIS can handle it. How is that so? How can IIS know what's my latest web site version? What's the difference between typing the address in the browser and compiling the web site, and what does localhost has to do with all of that? And last one - is the IIS on my machine accessible to other computers on the net?
Edited the last one..
Thanks a lot.

localhost is an alias for the loopback address 127.0.0.1. It's not actually hard-coded; you can find it in C:\WINDOWS\system32\drivers\etc\hosts.
Pointing your browser to http://localhost/... will open port 80 on your local machine, which is the port IIS listens on by default. IIS doesn't actually know your website's latest version. It will simply find whatever assemblies and other files it has been directed to use, in whatever state they are in. Compiling will generate new assemblies to match your latest code, and IIS will pick those new assemblies up on the next request that hits the site.
The localhost address isn't accessible from other machines. They will almost certainly have the same alias, pointing to their loopback interface.

Related

How to uninstall this default localhost website from my machine

I installed a Microsoft Navision Demo Server on my machine recently for testing/research purposes. When trying to work on one of my websites I noticed that when I browse to http://localhost/ ; this welcome page is being shown, does anyone know how to remove it? I have removed all Sites in IIS Manager but that hasn't helped. When I browse to 127.0.0.1 I get to see my own website that I am working on though.
Deleting the sites from IIS Manager actually did do the trick. It was a matter of clearing the cached localhost website from my browser.

Browser Link - Connection Actively Refused

EDIT
I believe now the problem lies in the fact that Visual Studio is not launching the server (or whatever it is) for the browser to call back to. I do not know if this is some service, its dependencies, or anything else about it!
Original
When running a MVC project in VS 2013, my Browser Link is not working correctly. The problem is that the URL to the browser link javascript file is being actively rejected.
An example message from fiddler:
[Fiddler] The connection to 'localhost' failed. <br />Error: ConnectionRefused (0x274d). <br />System.Net.Sockets.SocketException No connection could be made because the target machine actively refused it 127.0.0.1:27244
I've verified the following:
Same project works fine on other machines
The site itself works (on a different port)
vs:EnableBrowserLink is absent from web.config
Browser LInk is enabled
debug is set to true
The <!-- Visual Studio Browser Link --> portion is rendered in the page, thus confirming (even more so) that the browser link is enabled.
Read every article on how to use Browser Link - none detail what happens if the connection to the script is refused
Same exact problem on all browsers
Same exact problem on all web projects (I've tried several, even fresh 'vanilla' one)
Restarting VS, computer, doesn't fix
Running VS as admin doesn't fix
Running in Safe Mode doesn't fix
Disabling all VS extensions doesn't work
Running 'repair' on VS also does not work
The port that it's attempting to reach (in my example, 27244) does not show up at any of the IP addresses in netstat -aon
To me this means it fails to start
Firewall (even the corp one) is not blocking any of these ports
Procmon and Procexplorer reveal nothing I can understand to be as to why VS is not starting the SignalR process(es).
A brand-new project w/ SignalR from NuGet works fine - there must be something different on how VS uses it interally
I don't understand how the port it uses is generated, but it's different for every project.
I understand that Browser Link uses SignalR on the insides, but my research on that and connection refused leads me just enable port 80, which obviously won't help.
What else could it be? Any ideas? Where can I check?
Unfortunately, I was unable to pinpoint the exact reason... however, my problem has been solved. Uninstalling and reinstalling Visual Studio entirely didn't seem to help. What finally seemed to help was assigning port 44399 to a port on my local IIS. This forces Visual Studio to use a different port, 44398, and from that point on Browser Link started working.
I'm left to assume that the SignalR server was unable to start due to that port being inaccessible, although I am not sure why.

Debug VisualStudio in tablet instead of desktop

My question might be silly but I'm new and I really need help.
I am making some changes to a nopCommerce site in VisualStudio. When I hit run in Google Chrome it starts on localhost:number and I can debug from my pc (meaning break points are hit when I go to specific pages).
What I need to do is debug my site while connecting to it from my tablet instead of my pc.
I think I can do that. Can someone tell me how?
Thank you for your help :)
This is not a complete answer, but the following link will give you the nuts and bolts of what you need to do in order to achieve what you are after:
http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx
Make sure you do the Ninja way, not the easy way.
After configuring the IIS Express settings and setting up the host header, you can debug from any device that connects to the internet from the same subnet where IIS Express is. You can ignore everything else that has to do with setting up the self-signed SSL certificate and serving up content over port 443, it sounds like all you want is port 80.

TFS Change server port and visual studio 2012, problems

I have been using tfs with no problems on local network with port 8080. Then i decided to change the port.... why o why did i bother. I have had a terrible few hours trying to sort it. Searched goggle for fixes etc. I think i now have it working but only after reall problems, this then makes me wander and worried about how to from visual studio 2012:
have a local area network conenction to tfs: servername:9876
remote connection: domain name: domain.com:9876
both of which map to the same folders on pc/ laptop and same projects on tfs server.
This caused masses of problems, i then delete the server and re added the correct one. Deleted all cache and workspaces. But then i couldnt map to location as it existed. then couldnt create a new worksapce it said it existed even after delteing the cache. In the end i delete all again, chose a new location on pc for to pull down solutions in tfs. This worked but i am afraid if i look at the solution file in notepad the server port is 8080 still even though the server is now 9876. Based on the above 2 questions what should i do next time. Or even should i still do to make sure all is clean and tidy.
I must have this wrong as it cant be so hard to change the port nunmber of the server or even the server name its self.
thanks
TFS also registers your workspaces and machine names on the server. Run tf workspaces from the command line to figure out which and tf workspace to remove them. That should unblock you. Renaming your local machine (the client machine), or mapping to a different location on your local disk will unblock you.
You should use one single machine name, both locally and remote for the TFS server or map them as if they were different servers. Using both server names completely screws up the local cache, since the API will figure out that they're actually the same server because the Project Collection GUID and the Server ID match.
You could even use a line in your hosts file to be able to always use the same machine name.
I can't find the definitive piece of documentation that tells you to use the same name for all locations, but this blog post comes close. Architecturally, there are no changes between 2010 and 2012.

Visual Studio: Debugging non localhost domain, locally

I have an entry in my hosts file that points somesite.com to 127.0.0.1 (localhost) so that I can test certain aspects of my web app (i goto http://somesite.com in a browser to test). Can someone suggest a way to debug a setup like this (in visual studio) that does not include using http://localhost?
I understand that this can most likely be done using remote debugger, if that is the best way can someone explain how thats setup (or a link to a good article).
Set up a virtual machine, and run the web app in the VM. If you have two network adapters in the machine, you can even set things up so the network traffic goes out one, to a switch, and back in the other to the VM (I've done this sometimes so I could capture the traffic with WireShark).

Resources