I had this problem and solutions found online did not help. Here is what worked for me:
When the problem occurs...
- Change the startup project to another project in your solution.
- Run that project once.
- Change the startup project to the original project.
In my case, an error popped because the chosen port was already used. This means, you have to select a new port. For some reason, the chosen port is sometimes taken and sometimes free.
To select a new port, right click on your projet then Properties
. In the Web
tab, change the port in the Project URL
filed.
You should avoid using a port from 0 to 1024. Select a funky number like: 12321 or 23432 which is high enough an easy to remember.