Need to restart Visual Studio 2017 for IIS to work - c#

I'm developing a site with .NET and C# in Visual Studio 2017. When I first load the project, I can press the green arrow IIS Express button and it opens a new browser window and everything is fine. However if I stop it or exit from the browser tab, the next time it doesn't load the page. It opens the browser window, but says it cannot connect, and the IIS Express button doesn't stay grey and goes back to white. This started happening only recently, and I've not made considerable changes to the codebase; I don't know why this is happening now.
All I have to do is exit Visual Studio and open it up again, then I can run IIS Express for one time before it stops working again.
I don't see any errors, I've tried running in Administrator mode, and I've assured that it's not trying to use a port that's already in use. I've also tried updating VS 2017.
Where do I start looking into this problem?

According to your description, I guess you may install some third-party extension in your visual stuido that casuing this issue.
I suggest you could try to ​​​​​​run VS with safe mode to check if this is working well or not.
About how to run VS in safe mode, you could refe to below way:
open CMD and go to C:\Program Files (x86)\Microsoft Visual Studio\2019\version name\Common7\IDE folder, run the command: devenv /safemode
Besides, I suggest you could try to reset all the VS setting to defauly.
Details, you could refer to this article.

Related

Visual Studio 2015 not working after first successful debug

I have updated Visual Studio 2015 to the first update. Since then I cannot debug my code twice in a row. It goes like this:
I start VS and try to debug. So far OK
Change code, build and debug.
Try to reach a web but it never loads.
If I close the VS and load the solution again it works or If I do not change code in step 2.
Other thing I noticed is the IIS Express Worker process is consuming most of CPU time.
And apparently the symbols are not loaded (I do not see the messages of DLL loading in the status bar).
This is making my development process very slow and tedious.
The solution is a MVC project under 4.6.1 framework.
Any ideas? Thank you very much!!
You should boot Visual Studio into Safe Mode. To enter safe mode do the following:
Open Command Prompt, as Administrator.
Enter: cd C:\Program Files (x86)\Microsoft Visual Studio 14.0
Enter devenv.exe /safemode
If Visual Studio does load and debug, then more than likely an extension or an update is the culprit. This will allow you to also see which updates may have occurred. The other potential issue would be if your Internet Information System had an issue.
Otherwise if your Internet Information System is stuck 'on'.
CTRL + ALT + DELETE
Go to processes, end W3P process.
Try to launch and debug inside Visual Studio.
Otherwise, simply try restarting your computer. We would need more information, as this can occur for an assortment of reasons.
#Julen - I have the same issue as you and I have found a work-around.
Add the "Terminate all" button to your toolbar and use it instead of just stopping the debugging. This command kills the IIS Express process.
See how to add it here:
Automatically Kill IIS Express Process After Debugging (VS Express 2013 Web)
If your IIS doesn't shut down after stopping the debugger, you could do one of the tricks written in this blog post - but the opposite way because the article focuses on keeping the debugger on.
Here is the proposed solution 2 - to check "Enable Edit and Continue":
Similar to VS 2013, if you disable Edit and Continue IIS Express will continue to run when you stop your debug sessions.
Open the menu item Tools/Options, look for the Debugging/General option. Scroll down and uncheck “Enable Edit and Continue”
It might be hanging when trying to load external symbols. I had a problem with that before.
To test this theory:
Open the Tools menu.
Click 'Options'.
Find and expand 'Debugging' on the left.
In the 'Symbol file (.pdb) locations' list, uncheck everything.
Click OK and see if the problem reappears.

WinForms App Doesn't Run Outside Visual Studio

I'm using Visual Studio 2013, C#, Windows Forms application on a new laptop with Windows 7 Ultimate.
From within VS, if I Build and run my app, it opens fine (no errors or warnings). If go into the debug folder and double click the exe file, the app doesn't open. It appears in task manager, but I can't kill it. I get no error messages. Because it's running, I can no longer Build or run the project from VS as the file is in use.
I tried Building to Release and got the same problem.
The only way to get rid from the task manager is to restart the laptop.
This wasn't a problem on my old PC - which also had Win7 Ultimate and VS2013.
Do you know why my exe isn't running and why I can't kill it in Task Manager? Any help would be appreciated.
I had exactly the same problem. I have VS Express 2015 for Windows Desktop. Recently build app worked only from Visual Studio, old builds work fine. After some research I found that the promblem was my Avast Antivirus 2015, which prevented the new apps from running.
So I suggest, if you have Antivirus running, pause it for a while and see what happens. If indeed that is was the cause for your problems, the configure Antivirus so that it will not check your app when loading.
In Avast: Settings->Active protection->File system protection
(Not sure if that is excatly so, because I have Avast in other language than english)
Hope that works!
I have the same issue with Avast 2015 (licensed) that locks File Explorer up if I double click my c# apps in the bin\debug or release folders.
As others have suggested, rather than disabling Avast "Scan programs while executing" you can add your app path into the scan exclusion list via:
Left click the Avast Icon
Click Settings
Click Active Protection
Click Customize link for "File System Shield"
Click Exclusions and add your build folder. e.g. \bin
Also,
If Windows Explorer has locked up because of this issue, rather than rebooting you can open Task Manager, end-task "Windows Explorer" (your start bar will vanish) then click File->Run new task and type in Explorer, then hit enter to get everything back.
Cheers

Program doesn't work outside Visual Studio

I use unmanaged dll with P/Invoke in this app, and I always tested it inside Visual Studio (with debug mode on x86 CPU because the dlls are only x86), and it works just fine. But when I just start the exe manually after some time (probably at the first operation with those dlls, but I don't know exactly) it says the exe has stopped working, and it starts checking for solution (I use Visual Studio 2013 on Windows 8.1, if that matters). I tried to add the dlls to the project as existing item, but that doesn't help. Also I know, that it's not because it can't find those dlls, cause if I delete them, it doesn't crash, just freeze without any error message. Shouldn't it work the same from Visual Studio as manually started?
There is also a weird bug when I run from Visual Studio: everything's work fine, but sometimes Visual Studio just suddenly stops debugging, as if the program were closed and the GUI of my app freezes, and I can only close it by closing Visual Studio (as I close it, the GUI disappears). Maybe it's a totally different problem, but it can be connected.
Edit:
Here's the project on github, if somebody could check it:
https://github.com/geiszla/CycriptGUI
Some news: If I run it with Ctrl+F5 it also crashes. What's the difference between F5 and Ctrl+F5, that can cause this problem?
Searched all over Google with no real simple answers. Here it is folks(at least it worked for me and is simple):
When you run the console app in Visual Studio, look at the output window at the bottom, get the location of the ..\bin\Debug\*.exe
Copy the *.exe and the *.config to your desired folder, run it, it should work the same way in Visual Studio.
Thanks for every help, my problem was solved: I called an unmanaged function with only 2 parameters, while it had 3. However I still don't understand why it worked with debugging mode, and not without debugging.

Visual Studio Solution freezes when I try to compile

I have no idea how to even approach debugging this issue. I have a solution with four projects in it and all of a sudden it has stopped functioning properly.
When I open the solution and click on anything, it freezes up and it says that 'Visual Studio is busy waiting for an internal operation to complete". It gives the same message when I try to build the project, although it never actually opens the file or builds - I have to end the process in order to escape.
To troubleshoot this you could start visual studio in safemode, by running: devenv.exe /SafeMode. It loads only default settings and services. If it works then the culprit is something like an extension or a third party package.
You can also start Visual Studio with logging:
http://msdn.microsoft.com/en-us/library/ms241272.aspx
For a list of other command line switches you can use, like /ResetSettings, you can follow this link:
http://msdn.microsoft.com/en-us/library/xee0c8y7(v=vs.100).aspx
Perhaps you should install the Visual Studio 2010 Diagnostic Extension, to try and capture some data that can be sent to MS for analysis.
What works for me is opening VS, opening a working project and then opening the one that is experiencing the problem. Everything works fine after that.

Debug Techniques: Visual Studio 2008 Process fatal crash after debug of WPF application

I have a relatively large C#/WPF Visual Studio 2008 solution that I am trying to test and synchronize across 2 developer's computers. On my computer, I am able to build and debug (run) the project successfully without errors.
On the second computer, I am able to build the solution without any errors. When I attempt to run the solution, Visual Studio starts the process but about 3 seconds later the entire development platform exits. Before it exits I briefly see one of our .xaml files opened by visual studio with a yellow 'unhandled exception' box pop-up on a certain line number. I'm currently contacting the part of my company who is responsible for implementing the functionality of that xaml file.
This raised a bigger issue in my mind: How can you troubleshoot an issue when Visual Studio is immediately exiting after attempting to run a program?
The Visual Studio 2008 crashes when starting to debug post may also be helpful. I'm trying those solutions now.
We found that executing the three following commands helped to fix our problem:
devenv.exe /ResetSettings
devenv.exe /ResetSkipPkgs
devenv.exe /Setup
This was suggested in another stackoverflow post here helped us to determine that it was a plugin, AccuRev's Visual Studio plugin, that was causing the issue.
The issue also appears to be a "known issue" with a hotfix from Microsoft, documented here.
VS2008 SP1: In Visual Studio 2008 SP1, having windows in non-default locations, for example after docking and undocking windows, when switching between debugging and designing or switching to/from full screen, can result in a crash of the Visual Studio IDE.
Thanks for your help!
Run devenv/debugexe to debug your exe. When an unhandled exception occurs, in the debug menu, select "save as dump", then visit http://connect.microsoft.com/visualstudio to open a bug report and attach the dump file after creating the report.

Categories