Intro:
When i run an asp.net web app that is freshly created, it runs just fine.
However, it runs only for the 1st time. Subsequent runs will fail with this message:
The only way to make it run again is to restart VS2017.
Not even restarting IIS/IISExpress will make it work again.
At this point my instincts tell me there is something stupid/silly going on. What on earth is going on here?
Here is my configuration:
I am using Visual Studio 2017 Version 15.8.4
.Net Framework Version 4.7.03056
Project: Asp.net Web Application (.Net Framework) ==> MVC
This is being run under - IIS Express (Internet Explorer)
Here are more details about the error im seeing:
The error page simply says "Can't reach this page".
When i click on the "More information" expansion link, i see following (mentioned above):
There was a temporary DNS error. Try refreshing the page.
Error Code: INET_E_RESOURCE_NOT_FOUND
Now, if i click on the "Fix connection problems" button, the Windows Network Diagnostics window popups up and says:
The remove device or resource won't accept this connection
If i click on "View detailed information" link at the bottom of this popup, i see following details:
The device or resource (localhost) is not set up to accept connections on port 'X' (where X is my localhost dev port).
Summary:
In the end, there is no real reason why port 'X' is not working any more. If i change the port number from Visual Studio the web app will run. But as i mentioned before, restarting Visual Studio will allow me to run for the 1st time.
* Updated *
I found a great work-around solution. Instead of running (F5), i
simply choose a view (.CSHTML) and execute that view itself
(right-click --> View in browser). This seems to work just fine every
time without messing up the port.
I have set up project to be run on IIS for some time ago and when I did press F5 it did connect no problem. But recently this stopped working and I did get this error when I press F5 / press Debug->Start debugging:
Unable to start debugging on the web server. The remote server
returned an error: (404) Not Found.
Here is my settings:
I am not sure what happened, probably some VS updates or Windows updates, but I've tried to google everywhere and nothing had worked. Attach to process works fine as before, but this simpler way stopped doing the trick.
Update:
Have tried Process Monitor to figure out what is going wrong and it looks like w3wp tries to access path MyProjectFolder\debugattach.aspx and the result is "NAME NOT FOUND". Don't know if this is the root of the problem though.
It appears that one of my colleagues has edited the web.config and added request filtering where he has removed the "DEBUG" verb. This disallowed debugging on F5.
After adding it (or removing request filtering) everything works fine.
P.S. A lot of other possible problems with similar error is described here
In my case (Windows 10 & Visual Studio 2017) I had to install ASP.NET 3.5 and ASP.NET 4.7 under the Internet Information Services.
Click here to see the solution
Old post but I recently had this issue and making sure that the following settings were enabled in 'Programs and Features' (Windows 10) fixed the issue for me:
This happened to me because I was using the Rewrite module to redirect to https. I was running https://localhost/WebSiteName, but had put my machine name in the https binding in IIS Mgr, Default web Site, Bindings. When I removed the machine name it worked.
Recently I have faced the same issue in VS2013 Professional, instantly I get error 'Unable to start debugging on web server". I observed that whenever my current page is MVC view (.cshtml) file and I start debugging , the error window prompts every time. As switch the current document in my project to controller (.cs) file, and starts debugging, it works properly.
So my workaround is to debug my code I have to be on (.cs) file not on (.cshtml / web.config) file. Hope that helps!
Another reason for this problem is that you don't run visul studio Run as administrator.
My issue was related 405 as attached below
My issue got resolved after making my projects properties(Web and Build) as given below
see this also
HTTP Error 404.3-Not Found in IIS 10 as it helped me (HTTP Activation need to be enabled in Windows features)
I am having a problem with my application. The application works perfect on my development machine. It fails, without any errors on the live server. The page loads, but the code doesn't execute apparently.
I have been stuck on this for a while because I can't figure out how to get any information on the problem. There are no errors, so my custom errors settings in web.config are not helping.
I looked around online and I heard there was some remote debugging tool. The article was from .Net 1.0. I tried to follow it, but its not going to work because I am using a shared server. I do not have permissions to start the remote debugger on the server side.
I tried creating some output text files with variable contents, but the files are not being created either. They are created on my development machine, but never show up on the server, again with no error.
I have no idea how I'm supposed to figure out what is going on, because I'm not able to step through the code once it's on the live server.
Is there anyway to step through, or debug the code once I've published it? If I spent the extra money on a VPS, would that allow me to debug on the server side? I'm assuming I could just install Visual Studio on the VPS and step through the program. I've never used a VPS before.
Unless you do something very special in your code, it is unlikely that it behaves differently on your server compared to your workstation.
It is more likely that the configuration on the server is not correct.
You are saying your
code doesn't execute
How do you know that? You should first confirm that your code is actually executing.
you are also saying:
it is now directing me to a page that says "Directory Not Found"
a web server it never looking for directories, it is looking for resources, check your iis http logs what substatus codes are you getting?, enable Failed Request Tracing and review the logs.
Using Process Monitor can also help determine what the web server is doing.
Start with a very simple page and see whether that executes fine.
What I'm saying is, first debug/fix the execution environment before trying to debug your code.
You would never install Visual Studio on a server, the default installation of a Windows Server doesn't even allow you to install it. Instead you can use remote debugging components on the server and use your local Visual Studio to debug remotely.
When I try to debug my VS2010 web app (F5), the IE web browser windows pops up but then freezes, and my VS2010 IDE window pops up an error message:
Unable to start program 'http://localhost:nnnn/Login.aspx'.
Access is denied.
I'm running VS2010 (10.0.30319.1), targeted to ASP.NET 4.0 (4.0.30319), in non-administrator mode, with ASP.NET debugging enabled, on 64-bit Windows 7 Enterprise SP1, with IE 9 (9.0.8112.16421 with update 9.0.29).
This web app and others I work with have been working just fine for several months, but they all started to misbehave in this manner a few weeks ago. At first, the first time I tried to debug (F5) I'd get the error, but after clearing it and closing the IE window and trying F5 again a second time, the browser would come up just fine. I assumed it was just some glitch, so I tolerated it.
Lately, though it has gotten worse, to the point that 90% of my attempts and re-attempts to debug the web app cause a hung browser and the error. It sometimes works, but most times it doesn't. I have to kill the handing iexplorer.exe processes to clean up my user space, otherwise I eventually get a message about not having enough files to start the browser. I try rebuilding, stopping the ASP.NET Development Server process, even exiting VS2010 and restarting it, but I can't seem to find the magic sequence of events to get it to work.
If I start without debug (Shift-F5), it works, but two IE web browser windows are opened, and both attach to the web app. I don't know if this is related to the first problem. And needless to say, this does not really allow me to debug my code. I tried attaching to either of the IE processes, but I still could not get the debugger to actually debug the executing app. (There is a message about no symbols being loaded for the attached process.)
Most of the solutions for this problem I've found say something about running with administrator access. I cannot do this, however; I work at a large financial company, and developers are not allowed to have local admin rights on our PCs. I don't control system patches, but I can request Help Desk ticket to resolve the problem; but I'd like to resolve this problem myself if it is a fairly simple configuration problem on my part.
Addendum
I should also add that I am not using IIS (because I don't have it installed on my system, and I can't use it anyway because I don't have local admin rights), but instead I am using the built-in Visual Studio Development Server. I've also selected a specific HTTP port number for it to use. Also, all of the directories I'm been using were created by me (as part of my project workspace), so there should be no access permission problems.
Like I said, I can sometimes get a debugging web session started, but most of the time I can't. So whatever is causing this problem, it is probably something intermittent.
This tend to occur when you try to run the full version of IIS rather than the Visual Studio Web Server or IIS Express. Have you tried running IIS Express instead? I think there's support for IIS Express that came with one of the later updates to VS 2010?
IIS proper definitely requires full admin rights in order to attach a debugger because full IIS runs under a system account rather than your own account. IIS Express (as well as the Visual Studio Web Server) however should run under your own user account and so debugging should work on the local machine even with a non-admin account.
One issue that might cause problems is directory permissions. Make sure that the folder where your Web files live are read/execute accessible through the file system for your user account.
Finally make sure you don't have some other instance of a Web service running on the same HTTP port.
I am having the same issue, it works when i don't choose to debug but CTRL+F5 to start it. F5 Debugger al
I get the following error pretty regularly when compiling in Visual Studio and running my web application:
"Unable to start debugging on the web server. The web server did not respond in a timely manner. This may be because another debugger is already attached to the web server."
Normally this is after having debug the application once already. From the command line I run "iisreset /restart" and it fixes the problem.
How do I prevent this from happening in the first place?
The solution that worked for me:
Open Command Prompt (Run as Administrator)
Write iisreset /restart
Now, go back to your VS and debug. It will debug your solution.
It worked for Visual Studio 2013 and 2015 too in my case.
I find that this happens if I'm debugging with Firefox as my browser. When I exit Firefox the VS2005/8 debug session doesn't terminate. I have not found a solution for this (yet).
If this is what's happening with you then a quicker solution than running iisreset is to hit Shift-F5 when in Visual Studio and this will terminate the current debug session. You can then hit F5 and this will start a new debug session.
After trying all of the proposed solutions here and in other places (at least 10 different approaches), the only option that worked for me was:
delete website and application pool on IIS
re-create website and application pool on IIS (in my case, everything exactly the same config as before)
PS: I am using VS 2013 and IIS 7.5 (Win7).
I hope this saves someone else a few hours.
Go to task manager and end process aspnet_wp.exe before running application
I have had this problem a couple times. One time it was resolved by taking Guy's advice:
If this is what's happening with you then a quicker solution than running iisreset is to hit Shift-F5 when in Visual Studio and this will terminate the current debug session. You can then hit F5 and this will start a new debug session.
On a separate occasion I had to: terminate all my IIS worker processes in the windows task manager (w3wp.exe*). You should be able to hit f5 in visual studio to debug.
It sounds like you are probably hitting F5 in Visual Studio when you receive this error?
There are a few things you can try. The easiest is to hit the Stop button before hitting F5. Optionally, when you are finished debugging and starting to make changes you can go to the Debug menu and choose either Stop Debugging or Terminate All.
We use another way of debugging, we never use F5 anymore.
We use a macro kind of like: http://blogs.conchango.com/howardvanrooijen/archive/2007/06/24/Attach-to-Web-Server-Macro-for-Visual-Studio.aspx (Which we bound to F6).
This way you simply attach the debugger to IIS. It's (depending on project size) much quicker to make you changes, compile a single project that you changed and attach the debugger again.
When debugging 2 web application (1 MVC and 2 is MVC WebAPI) that are both hosted in the local IIS.
Make sure that each application is using a different application pool.
I encountered the same issue and as soon as I change the app pool of the other one, it worked!
I saw this message first time in my life and I was very confused about what is going on as it is not pretty obvious what to do.
I ran iisreset and it took just 1 sec to finish the execution, and boom, I was back into the game.
P.S. I am using chrome
Hit Shift+F5 when in Visual Studio and this will terminate the current debug session. You can then hit F5 and this will start a new debug session.
or
close your application, reset iis then open your application and run it
For me I had two visual studio open. The debugger already was attached to another visual studio :). I stopped it on the first one and was able to attach on the second visual studio.
Very basic - but check that if you try to run the web site from IIS by clicking on "Browse", the site actually runs.
It sounds like something is eating up your web server's resources. Perhaps you have some resources (file handlers, wcf proxies) that are being opened and not closed? I've had this happen to me specifically when I was not closing WCF client proxy connections.
The problem is not necessarily that you have a debugger attached, but only that the web server is not responding in a timely manner. Note that the message says "This may be because another debugger is attached".
If you have a lot of break points this will slow the debugging process down, so remove unneeded break points and close the Autos window this will solve your problem
The issue is normally there when an another instance of iexplore is still running. I used to have the issue when my IE crashes but I can still see it in the Task Manager. Once you "End Process" everything is back to normal :)
I ran into this issue when trying to debug (2) separate solutions in VS.NET and both were using the IIS Web Server to launch the app. The 1st application will start, but any subsequent applications started that also run via IIS will then display that error. It seems that it can only debug a single application via VS.NET hosted in IIS at a time.
The solution: run project 1 from VS.NET (place any needed breakpoints) and start the second application directly from IIS (not VS.NET). Your breakpoints in App 1 (running in VS.NET) will be hit when accessing App 2 (ran from IIS directly).
This happens to me quite a bit in VS 2010 express - Usually because the debugger stopped responding.
Right click windows taskbar, select 'Start Task Manager'. More than likely the ASP.NET debugger will be showing a 'not responding' status. Select it and simply terminate the process.
Done!
With me it happened when IE was upgraded to newer version, went to Installed Updates, removed new version of IE, after computer restarted it went back to old version and problem with debugging was solved
Had the same problem, even after a reboot. Basically did this:
Restart IIS
Clean Solution
Rebuild Solution
Then it started working again.
This can also be caused if your website uses a database connection but the database server is unavailable.
I spent some time trying to resolve this issue in the usual ways, but even after restarting my workstation, the issue remained. Eventually I found that the SQL Server (MSSQLSERVER) service was not running.
It should have been running, as it's set to Automatic, but it was stopped, even after the reboot. All the MSSQLSERVER events in the event log appeared normal, so it remains unknown why it wasn't running, but I have now set it to Automatic (delayed start) in the hope that this will reduce resource contention during startup.
Once I started MSSQLSERVER , the message "Unable to start debugging on the web server. The web server did not respond in a timely manner" no longer appeared and normal service was resumed.
I had to recreate the site/application/virtual directory to make it work after I installed vs2015 update3. Hope this helps someone. ;)
I know this is an old question, but I met the same situation recently and try every solution in this post, and no luck. Finally, I found the solution that works for me:
Close Visual Studio
Find Turn Windows features on or off in Control Panel
Uncheck Internet Information Services in the popup dialog
Restart your computer
Check Internet Information Services in the same dialog, and make sure Internet Information Service -> World Wide Web Services -> Application Development Features -> ASP.NET also been checked
Open Visual Studio, and now your application should be able to run in debug mode
Open
Options and Settings Under the debug
Symbols and unchecked Microsoft Symbol Servers
build solution
iisreset
F5 solution
(Be sure Microsoft Symbol Servers unchecked again)
This worked for me by #mtkachenko
Visual Studio 2012: Unable to attach the process. A debugger is already attached
"I have installed Debug Diagnostic Tool v2.0 and as a result I have Debug Diagnostic Service which is started automatically and attached to one of w3wp processes. After turning off and disabling this service all works fine. So if you get such error check processes in task manager which can capture your w3wp process"
I got it worked by creating a new ApplicationPool in the IIS Server and pointing my application to the new ApplicationPool. I have also deleted the old ApplicationPool
This answer will only apply if you are running your solution through IIS. You will know if this applies to you IF you open up your website/project by doing the following:
From within visual studio-->Open Website--> Local IIS -->Select your project
This error Kicked my butt for 4 hours but finally I found an answer. I first attempted the iisreset /restart. This seemed to slightly help but still received the same error.
What worked for me was going (xp machine) to add/remove programs --> Add/Remove Windows Components--> Click on IIS--> Click on "Details". Be sure to have Front Page Extensions installed if you are debugging through IIS.
If all the answers does not work for you, just end process all IIS related components in task manager. This is what worked for me.
I just solved this problem on my machine.
My problem is that I upgraded IE 9 To IE 10 and I got this error.
Solution : Remove IE 10 and downgrade to IE 9.
Go to "Programs and Features" --> "View recent updates" --> find IE 10---> Uninstall it-->reboot--->ie 9 is back--->debug--->works OK.
Try performing either of the following steps to resolve your issue:
Restart your IIS Server
Clean the Solution of your project then build again
If above steps do not help, you can finally try restarting your machine
In your cmd type iisreset and press enter after that your iis is reset and your application is working perfectly