26

Suddenly this morning I turned on my computer and launched visual studio... And no matter what I tried and whether I run or debug, and whatever the browser is ( chrome / firefox / IE 11 ) it is waiting for localhost forever.

If I deploy it to azure, by just checking in ( continuous integration ) it works like a charm

I've read both:

As I write, it has been waiting for localhost for more than 15mins. I restarted VS, even rebooted the computer... tried the ipv6 disable stuff on firefox...etc

I noted ( do not know if it is useful ) that Replacing localhost by 127.0.0.1 throws:

Bad Request - Invalid Hostname
HTTP Error 400. The request hostname is invalid. 

also my C:\Windows\System32\drivers\etc\hosts ( unchanged )

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#    127.0.0.1       localhost
#    ::1             localhost

Any idea ? I've not been able to show a single localhost page in 3hours.

gmalenko
  • 162
  • 4
  • 16
user2346536
  • 1,464
  • 2
  • 21
  • 43

13 Answers13

17

Check firewall for blocked ports, change dynamic ports of application to some fixed port.

husnain_sys
  • 571
  • 4
  • 14
  • 1
    I turned off avast and it worked. So not the firewall, but nearby enough. how do you fix the port of the application by the way ? – user2346536 Dec 26 '14 at 20:37
  • 1
    By fixing the port i mean specify a port in your asp.net application. Make sure to specify a port that is not used by other programs like skype, antivirus etc. http://msdn.microsoft.com/en-us/library/ms178109(v=vs.140).aspx – husnain_sys Dec 29 '14 at 08:18
  • I experienced this same issue recently with Symantec Endpoint Protection as it was causing files to load randomly slow, including static files like .css, .js, and .png files. Turning it off made localhost fast again. – Kcoder Dec 23 '22 at 02:00
5

I had a similar issue where my site got "Waiting for" forever. Tried restarting the website and nothing.

I was not able to reboot the machine (I am pretty sure that it would solve) so I kept investigating what could be.

I found out that, in my case, the solution was to change the "Application Pool" of the website. It appears that the current one crashed or something like that (I was able to stop it but not start it back again), so I created a new Application Pool and the site started working again.

rsc
  • 10,348
  • 5
  • 39
  • 36
4

Okay, I've found that this happens (on a server) when you've hardened security properly.

For example, you no longer blanket apply IIS_IUSRS to the wwwroot but setup proper accounts for each App Pool and are setting the NTFS perms properly.

The problem is that the worker process/ASP.NET wants to enumerate the files in the folders "leading up to" your website root. I think it wants to look for web.config files etc.

The failure to produce an error, i.e. the infinite loading is a bug in my opinion.

e.g. i:\wwwroot\project\virtual\base

You'll need to apply IIS_IUSRS group read access to wwwroot, project, virtual but not base. The trick is to only apply to the current folder, i.e. don't apply to subfolders and files.

Apply read rights just to the worker process/AppPool identity to the base folder.

If IIS_IUSRS has read rights to the whole tree, then all worker processes will have read access to all other website base folders and contents, such that a compromised site will be able to access data/config in other sites.

Luke Puplett
  • 42,091
  • 47
  • 181
  • 266
2

Sometime it happens due to issue with symbols loading. Try this

Go to Tools -> Options -> Debugging -> Symbols and click the button 'Empty Symbols Cache'

t4taurus
  • 345
  • 3
  • 13
1

In my case, the problem was that IIS didn't have sufficient permissions to the website.

I fixed it by granting Full Access permission to the IIS_IUSRS user on my entire website code folder (as in yoursolutionfolder\yourwebsiteprojectfolder).

Then after granting permissions, I had to run iisreset for it to start working.

Sam
  • 40,644
  • 36
  • 176
  • 219
1

In my case there was a problem with configuration of Visual Studio stored in /.vs folder inside solution directory.

During development a lot of changes were made in IIS configuration: creating new sites, replacing old ones, changing pools etc. So Visual Studio have lost "connection" to given site and its pool. After deleting of /.vs folder and launching of Visual Studio the new execution configuration was created and it was properly attached to current IIS configuration.

Nikolay
  • 309
  • 2
  • 8
0

Restarting the IIS may work as it will end the current instance and run your web page in a new instance.

Walt Ritscher
  • 6,977
  • 1
  • 28
  • 35
Dev_FullStack
  • 33
  • 1
  • 8
0

I had received a project where the webconfig had port number mentioned along with the server like this.

sqlConnectionString="Data Source=<<SQLInstanceName>>\SQLEXPRESS,<<Port>>;Initial Catalog=<<DBName>>;Integrated Security=false;User Id=<<UserName>>;PWD=<<Password>>;"

After removing the port number from connection string, the error message disappeared and code began to work.

sqlConnectionString="Data Source=<<SQLInstanceName>>\SQLEXPRESS;Initial Catalog=<<DBName>>;Integrated Security=false;User Id=<<UserName>>;PWD=<<Password>>;"

I am relative new to ASP.net. Dont know if this is going to cause problem elsewhere (^_^).

0

My issue was a result of a not having proper credentials on the working website folder. If you arent sure grant full control to the folder as a test. User = IIS AppPool[app pool name]

Brad L
  • 1
  • 1
0

For me, on aspnet core it was a problem in Configure() method hanging because of exception

FindOutIslamNow
  • 1,169
  • 1
  • 14
  • 33
0

I was Able to Connect to Application when asp.net waiting for <...> modal appear then i Click Browse in my IIS

enter image description here

note : You must create the Application Pool and Website manually and set the website pool to Application pool that you have been created before.

0

Please check WEB.CONFIG file, I had a similar issue where my site got "Waiting for" forever. Tried restarting the website, laptop nothing happened, it was prompting me for SQLServerExpress, I realized that the database server was not correct on my web.config so I changed it to the correct one which resolved my issue

Jani
  • 376
  • 3
  • 6
0

In our case, the issue was Symantec Endpoint Protection. By turning off the Enable Network Intrusion Prevention option on the Network and Host Exploit Mitigation module, Localhost was working again.

Kcoder
  • 3,422
  • 4
  • 37
  • 56