I'm playing around with a WCF service.
The problem I'm having is that VS2010 keeps randomly assigning a new port number to it when starting the VS Development Server even though I have set it to a specific port through the project settings.
If I keep stopping and starting VS Development Server for a few times with this problem, I get an error that says Unable to launch the ASP.NET Development server because port 'xxxx' is in use.
Why is this happening?
edit: It was suggested that this could be caused by the Dev Server not stopping. Unfortunately, it happens on a freshly started computer as well, i.e. when no instances of it are running at all.
Also, after I get the error message, it doesn't matter if I change the port, or select the Auto-assign Port option. The result is the same.
I have seen it sometimes and it seems that the webserver doesn't stop at times. So next time you fire up your project, the previous server is running at the same port.
The solution is to explicitly close the previous one and retry.
On the project properties of the web app project (right click and select Properties) Web tab, change the radio button to 'Specific Port' from auto select. That should make the port number totally consistent.
It turns out that the problem was linked to the issue answered at Visual Studio Development Server using wrong port.
I didn't suspect this to be the cause because I didn't have a blanket problem. I could launch the WCF solution at times, but not at certain other times. I could also run an instance of the Dev Server for an MVC solution with a specific port applied without problems.
Related
I started having this issue yesterday, but suddenly I'm unable to run even basic projects. The project starts as expected, but then the browser always shows this in microsoft edge. This is literally the boiler plate project generated when making a new application. Has anyone else run into this problem and came up with a solution?
This is what I got my features set to...
Edit 1:
I've been able to confirm that I do not have the issue with older .NET Framework projects running off of IIS Express. The issue seems to be purely when trying to run .NET Core applications using Kestrel.
Edit 2:
Went back and tried to change the port number to see if that made a difference. Unfortunately, it didn't seem to do anything. (Swapped port number 5001 to 5501 just to see if it would load the template website.)
Also checked to see what is going on when trying to run the template program. I can see port 5001 appear, but the state is TIME_WAIT and it never gets to established.
Edit 3:
When I start the .net core app it does get this far on the server...
Going back in time, the last thing I was doing before this problem started was creating a new user for my local SQL Server as well a setting up a database. I had already installed SSMS and didn't have any issues before that point, but I'm unsure how setting up a new user for a specific database on the SQL Server in SSMS would cause this problem.
I used Code first migrations via command line EF tools. I'm pretty sure this isn't related, as the problems began before I got to this point.
EDIT 4:
I tried accessing the default site via IP instead of using localhost. Oddly, 127.0.0.1:5001/mycontroller works, but trying to access it via localhost:5001/mycontroller does not work.
Edit 5:
I ran a test to see if a .net framework project can successfully launch and show up on localhost to make sure the issue is strictly with .NET Core applications using Kestrel. As it turns out, running an older .NET Framework style project on IIS Express does work on localhost.
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.
Every time I build my solution and try to start debugging, I get this message:
Unable to start debugging on the web server. The web server did not respond on a timely manner. This maybe another debugger is attached to the web server.
If I restart my IIS, I can start debugging but If I build again I have to restart my IIS again. I saw several people having same issue but no one same as mine exactly.
Open your cmd in administrator mode and run cmd
iisreset
The below link contain some useful answers:
Unable to start debugging on the web server. Could not start ASP.NET debugging VS 2010, II7, Win 7 x64
Like this answer:
1)
Try going to IIS and checking to make sure the App Pool you are using
is started. A lot of times, you will produce an error that shuts down
the app pool. You just need to right click and Start and you should be
good to go.
2) And this answer
Turns out that the culprit was the IIS Url Rewrite module. I had
defined a rule that redirected calls to Default.aspx (which was set as
the start page of the web site) to the root of the site so that I
could have a canonical home URL. However, apparently VS had a problem
with this and got confused. This problem did not happen when I was
using Helicon ISAPI_Rewrite so it didn't even occur to me to check.
I ended up creating a whole new web site from scratch and porting
projects/files over little by little into my solution and rebuilding
my web.config until I found this out! Well, at least now I have a
slightly cleaner site using .NET 4.0 (so far, hopefully I won't run
into any walls)--but what a pain!
We are running automated tests from Visual Studio. Some of these tests needs to communicate with a temporary Redis server and we therefore launch redis-server.exe in a JobObject during test execution.
The redis-server.exe executable file is deployed to the test run directory by declaring [DeploymentItem("redis-server.exe")].
This works fine except that for every test run an annoying Windows Firewall popup is displayed:
Is it possible to prevent this popup from being displayed?
Would it, for example, be possible to tell Windows that any redis-server.exe located under a specific directory is allowed to use the network?
This is particularly annoying because the dialog fulfills no purpose in this case. No matter whether I choose to click on Allow access or Cancel or even just ignore the popup, the tests will still complete. However, a new firewall rule is created every time.
No idea if it's actually possible, but the best solution would be to change the listening settings on the temporary server so that it listens on 127.0.0.1 instead of 0.0.0.0, causing it to only accept connections from the local machine. For a test it's perfectly acceptable, and such a listening will never trigger firewall warnings.
I know that this post is related to VisualStudio, but I had exactly the same problem, but with Intellij and Java.
In Java, it is possible to configure the server like in the following piece of code to achieve the same thing (no firewall warning being displayed):
RedisServer.builder().setting("bind 127.0.0.1")...build()
The trick is the setting value "bind 127.0.0.1".
With this configuration no more firewall warning appears.
I found the answer in the embedded-redis project on GitHub (here).
I've got a Visual Studio 2010 MVC 3 Azure project that is acting very weird. When I first start it up, it runs under port 81. As I work throughout the day, the port number will increment upwards (81, 82, 83...) as I run/debug my project locally. It doesn't increment everytime. I've gone into the web role project and specified the port number, but Visual Studio ignores my entry and keeps the number it had before. I've closed down VS and done reboots, none of which has helped. Has anyone else seen something similar to this before?
Are you sure you are not confusing the ports you can set on a web project with the ports that will run in the emulator? These are not the same. VS can use IIS Express or Cassini which will allow you to set ports for a web application. However, the Windows Azure emulator uses real IIS, which has nothing to do with the ports you choose in a web project.
The deal is that the emulator will try to take 80 and the incrementally go up one everytime it sees a reservation or bound application. Sometimes you need to restart it (and wait about 2 mins) if you see it keep getting higher and higher. Most people will see the emulator grab 81 because their IIS Default Web Site is already bound to port 80. If you want 80, just go to inetmgr and remove the port 80 binding from Default Web Site (or delete the site). Next time you start the emulator, it will grab 80.
I see this sometimes, and usually stopping the Compute Emulator (which then restarts during next debug session) fixes it.
There is nothing wrong with that, it will work in the specified port on the real cloud.
Imagine that you create a web application on port tcp 80, with 4 instances ... :) you cannot open 4 times the same port. So don't worry about that.
Cheers.