IIS Express 'The specified port is in use' Visual Studio 2015 - c#

Apologies about the long message, but I thought I should let you know what I have already tried.
I've very recently started learning C# through Visual Studio and all was going OK until about three weeks ago. I clicked on the button with a green triangle which did the usual thing of launching the internet page, but the site never loads. I then noticed there was an ISS Express notification which brings up the following (can't figure out how to get my cropped screen shot on here):
'The Specified port is in use
Port 49665 is already being used by process "svchost.exe" (process ID "2112")
Recommendations
Try switching to port other than "49665" and higher than 1024
Stop the application that is using port "49665"'
I have managed to locate the svchost.exe on my computer and it is in the system 32 folder. There doesn't appear to be an option to stop it, and I am worried deleting it will break my operating system (I did click delete to see what happens and got an error saying I need permission from trusted installer to do this, but didn't go any further). When I open task manager and look through all tasks, including 'background tasks' and 'windows processes' and can't see it anywhere
I have tried to follow the advice in this discussion:
IIS Express Web Server Port Is In Use
But I cannot fully understand where the solution was- I don't think I have anything called ISS installed, however there is a Local ISS when I go to 'file', 'open website', which I found through the following:
Why and how to fix? IIS Express "The specified port is in use"
I did as the answer marked 21 (with the green tick) suggested and restarted my computer (as one of the comments suggested) however my problem persists. There is no longer anything under 'IIS Express Sites'
I have closed all browsers then tried, restarted and then tried, still no luck
The third answer (7) I really don’t know how to do this (I don’t know what solution they are referring to), so if this is a potential solution I’d be happy for further instructions
The answer marked with a 5 about netstat -aob helped me locate a task called ‘service host: local service (network restricted) (6)’. Trying to terminate this task brings up an error saying that by terminating this task Windows will become unusable- so I assume this is why I couldn’t delete the above. The final part of this answer about elevated access I don’t know what this means or how I would do this.
Closing visual studio and restarting as an administrator doesn’t fix the problem.
I only have Edge and Internet Explorer and I have ended these via task manager whenever I have tried to resolve this problem, but it persists
I tried the answer at the bottom, but was not able to locate the folder IISExpress, maybe this is part of the problem?
Any suggestions where I might be going wrong with the above, or any further advice on how to progress some of the things above, or any new ideas will be welcome.

Thanks for the suggestion Methodman. After much digging I found the solution you suggested here (change the port): How can i change IIS Express port for a site
The answer provided provides excellent instructions with a step by step guide on how to change the port
Just changed the port number until I got one that worked :)
Ed

It is an old post but just in case someone having the same issue recently; I tried many things including removing websites, running VS in administration mode. Nothing worked. Then I finally changed the port which finally worked. Right Click on project. Go to Web on the left menu. And change the port number at the end of the project url to whatever you want. I changed it to 50645.

Related

WebClient.UploadString() fails with

I have an old .Net console application that is running as a job on a sever. One part of it is that it uploads / creates files on another server via System.Net.WebClient. Sometimes I need to run this console manually on my machine. This consolse applicatin was always working fine for me and it still runs fine on the server and also runs fine for all of my coworkers. However, it stopped working for me yesterday:
English translation for the error message is "This property is not supported by this class." Unfortunately there is no inner exception. So this is the only information I get from the debugger.
So I'm sure I did not change anything in the code (I also rolled back from source controll to make sure). I know that it is working for my coworkers. So there must be something wrong with my computer I assume.
I can still access the ftp target directory manually, so access problems are not the problem.
However the only change that I made yesterday was installing PowerShell 6 via the existing PowerShell:
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
But honestly: I'm not sure if this is the culprit (One of my coworkers also has installed PowerShell 6)
Uninstalling PowerShell 6 temporarily also did not help.
I already searched the internet for this problem, but it seems as if I'm the only one and I'm running out of ideas what I can do to fix this.
Does anyone of you have an idea what else could be done?

visual studio unable to start program access is denied

I'm getting "Unable to start program http://localhost:[port] Access is denied." when I try to debug an ASP.NET MVC app. Here are some more details, some of which may not be relevant.
This is happening under a somewhat different context for this project. I recently obtained an elevated account on the network, so now I'm running VS 2017 (15.5.4) as Admin every time I start it so that I can access the TFS server. Previous to this, I had been working offline with my non-elevated account and passing code changes to another developer for him to check in to TFS. I am still logged on to the local PC (Windows 10) with my non-elevated account. I just start VS as an admin and when prompted enter the credentials for the elevated account.
This morning was the first time I ran VS under this new context, got the latest code, and tried to do some work. I had to delete an existing TFS workspace, but I did get a complete refresh of the code from TFS.
The first time I went to F5 the code in this new context I get a warning about the app using SSL and VS wanting to self-sign a certificate. I said yes. I forget exactly what happened at that point, I think the browser (Firefox) timed out trying to connect. Anyway, I tried a different browser (Chrome) and still no luck.
Yet now, whether I , +, , or , I very quickly get the message from above "Unable to start program..." I've done a lot of searching on this problem, but have had no success in getting close to a solution. Here's what I've tried:
Cleaned the build and done a fresh rebuild. Building works, no issues.
Use netsh to look for (and delete) URL reservation. There wasn't one.
Tried using a different port.
Deleted temporary asp.net files.
Turn JavaScript debugging option off in VS.
Crtl+F5, w/o debugger.
Turn SSL off for the project.
Checked, Windows Authentication is on in web.config.
Used Process Monitor to look for any "access denied" for either devenv.exe or iisexpress.exe
So what I'm hoping for here is not so much a silver bullet (though that would be great), but more some help in troubleshooting. Access denied means some resource--a file, a registry setting, a network share, something--is inaccessible in the context in which I'm running. Exactly what that is has got to be recorded somewhere, I hope. What log files does VS write to when you hit ? I've looked at the output during build and there's nothing there.
I'm sure I haven't exhausted all resources in troubleshooting this, I just need some help on where to look. Also, I had to leave that project/site and head to another, so I won't be able to try any ideas you all throw at me until tomorrow, at the earliest.
Please take a look at these answers in a similar question. From the list you provided it appears some of these may be new things to try for your case.
Specifically, I have run across the following answers in that linked question that have worked for me at various times in my career:
If you're using Anonymous Authentication, IIS 7 will use the "IUSR"
account for directory access (unless you've set it to use the app
pool identity. If you haven't granted IUSR sufficient permissions on
your site's folders and files, you'll get this error
For me in windows 7 it started to work only after I gave 'Read &
execute', 'List folder contents', 'Read' permissions to site folder
for both users
IUSR
NETWORK SERVICE
I had the same problem, I enabled "Anonymous Authentication" but it
still did not work. So I also ENABLED "Forms Authentication" Then it
worked without any problems. (also try windows auth)
For me, nothing worked except the following, which solved the
problem: open IIS, select the site, open Authentication (in the IIS
section), right click Anonymous Authentication and select Edit,
select Application Pool Identity.
I gave access to "IIS_IUser" but instead it should be "IUSR". That
solved the problem.
I have a very similar problem with yours and my architecture uses windows authentication and what works for me is selecting my project and going to properties. Then select "Enabled" on Windows Authentication.

Can't access WCF service through browser

I've been following this series of tutorials (https://msdn.microsoft.com/en-us/library/ms734712(v=vs.110).aspx) on getting started with WCF, and it's all been going well up until step 3 (https://msdn.microsoft.com/en-us/library/ms730935(v=vs.110).aspx), specifically up until the bottom, where it says "Open Internet Explorer and browse to the service's debug page at http://localhost:8000/GettingStarted/CalculatorService"
Basically, what this should be doing (I assume, I've never tried this before today) is opening some sort of web interface to this service, where I can edit it.
I've tried using both Chrome and IE, and neither of them can connect. I've tried lots of different IP addresses (localhost, 192.168.1.8, etc.) and they all give back the generic "This webpage is not available".
I'm using Visual Studio 2015 Preview (that MIGHT be the problem, but it shouldn't be...) run as administrator (I've tried running the .exe directly as well) on Windows 8.1, coding in C#. I'm not too experienced in networking things, so I might be missing something obvious... any ideas?
I found the problem. In the main library (the one with the contract and implementation), in App.config, I forgot to change the address that it binds to. Setting this to the desired one (http://localhost:8000/GettingStarted/CalculatorService) seems to work.
HTTP 400 is significant. It means bad request - eg your service isn't receiving input in a way it expected, but it is there. Please update your question. That sounds like a mistake in your WCF config. Try this... Open up a command prompt and run C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat (Path for 2013, update as req'd). Then enter the command wcftestclient. It'll open up a gui that you can connect to the same url you're browsing to. It will attempt to talk to any WCF service listening there.

DNS error when trying to connect to Windows Azure Service Bus

The remote name could not be resolved:
'x.servicebus.windows.net'.TrackingId:bbfe86f8-b5d3
Doing an nslookup works fine.
I can hit the url from the browser with no issues.
Usually rebooting resolves the issue. It seems to be the consistent thing, but sometimes even this doesn't work. Sometimes simply waiting until later fixes the issue.
I've tried closing IIS express, resetting my ip, closing visual studio, etc., but nothing immediately resolves it, other than rebooting, but like I said this doesn't always work, so not sure it's even related.
I've tried disabling my firewall. I uninstalled norton anti-virus, but no luck. I've also disabled Windows Defender.
This only seems to be happen on my Windows 8.1 machine. Even when I'm
experiencing the error, I can run the same code from my Windows 7
machine with no problems. I don't use my Windows 7 machine enough
though to know if it is really a Windows 8 specific issue.
Microsoft mentions possibly using Shared Access Signatures as an alternative for connecting to the service bus, but I'm not looking to rewrite my code over what appears to be a possible bug in Microsoft's SDK. Does anyone know how to diagnose this? I am wondering if there are trace logs that can be setup in web.config specifically for the servicebus perhaps that might give me some additional error information. Or if someone else has run into this and can provide some insight.
This does not seem anything specific to the Service Bus APIs, you can get more information on the IP configuration and reset it on you Windows 8.1 box as follows:
Open an administrator command prompt and type the following:
netsh int ip reset
netsh winsock reset
Check if any errors are listed? If not, go ahead and reboot the computer.
This ended up being a server issue on Microsoft's end which is why it was impossible to resolve through code and machine changes. It took awhile for them to get it figured out and resolved. If anyone has a similar issue they may want want to consider this possibility as well and get in touch with Microsoft.

visual studio development server automatically redirects to default port with machine ip

This is a weird issue I have been facing for a couple of days now. When I run my ASP.Net web app from visual studio 2010, it starts the dev server and opens IE. I can see the correct URL getting formed (ex: http://localhost:53990/index.aspx).
But then it redirects to "http://my-machine-ip". I can see the dev server process (webdev) in task manager. If I browse the above URL in a separate IE instance, manually, I still get the same behavior.
This problem comes in chrome as well, but works properly in Firefox.
Since it was working in FF, I ignored it, but now an increasing number of my colleagues have started facing the exact same issue. Tried searching for a solution on Google and stackoverflow, but couldn't find any.
Has anyone else faced a similar issue? Would be great if I can get any help/pointers with this issue. Please let me know if you need more details.
PS: I am coding in c#, not sure if it matters but thought I should specify it.
I have faced this issue and resolved by following steps:->
Open IE
Go to Internet Option ->Connections
Click on Lan Settings
Uncheck Automatic detect settings check box.
Clear all browser cache/history
Try and browse the site now. You should be able to view your site
Since Chrome uses IE settings, this solution should work for Chrome too.

Categories

Resources