IIS Express giving a compilation error, denies access to files - asp.net

I am running Visual Studio 2015 on Windows 7. I have a solution with 2 startup projects, both running on IIS Express, and the .NET version is 4.5.2.
Whenever I start the solution for the first time, everything works as expected. However, when I stop the application, make some changes to the source code, and restart, I get this Compilation Error -532462766 screen on startup :
The detailed compiler output is filled with lines like this:
/R:"C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\vs\268da2e1\665f7c6d\assembly\dl3\a9f1f009\c9360fff_0864d101\ServiceStack.Common.dll"
Going back to Visual Studio, and selecting "Clean Solution" gives me these unable to delete file messages (username and projectname removed).
The only way to get things working again, is to right-click IIS Express in the notification area, exit the process, then clean the solution in VS2015, and rebuild. Everything works again then, until the next time I need to change something in the source code (which happens quite a lot, being a software developer and all).
It seems IIS Express or Visual Studio, or my Windows user account is not allowed to delete files in IIS Express. I have tried running VS2015 and IIS Express in administrator mode, but no luck. What else can I try?

Related

Visual Studio 2017 throws error on debugging an ASP.NET MVC application

I am setting up my new workstation (Windows 10 Pro) with my ASP.NET projects with Visual Studio 2017. I have enabled local IIS and the project throws a timeout error while trying to debug the project.
It is not failing 100% of the time though, mostly fails but when it runs it is taking longer than expected to give the startup page. The error thrown is
Unable to start debugging on the web server. The operation has timed out
I did notice that the IIS worker process (w3wp.exe) was only executed in the completed console output. So it looks like the IIS worker process is not always being executed.
Any help would be appreciated!
Thank you!
The project runs successfully on an old workstation (Windows 10 Edu) with Visual Studio 2017. App pool settings has been compared between both and it seems same. IIS reset is tried as well. Visual studio has been repaired and IIS local has been restarted as well (unchecking and enabling followed by restarting the machine). Default app pool is used and its been recycled as well. Nothing worked!
Possibly the Visual Studio project version does not match the ASP.NET configured application pool. Update the ASP.NET version in the application pool and restart it.
Make sure you have the correct version of ASP.NET installed on IIS. A version mismatch between ASP.NET in IIS and the Visual Studio project can cause this issue. May need to set the framework version in web.config. To install ASP.NET on IIS, use the Web Platform Installer (WebPI).
If the issue is not related to IIS configuration, try the following steps:
Restart Visual Studio with administrator privileges and try again.
For example, using the Web to deploy some ASP.NET debugging scenarios that require elevated Visual Studio privileges.
If you are running multiple instances of Visual Studio, reopen your project in one instance of Visual Studio (with administrator privileges) and try again.
If using a HOSTS file with a local address, try using the loopback address instead of the computer's IP address.
If not using a local address, make sure the HOSTS file contains the same project URL as in the project properties, Properties > Web > Server or Properties > Debug, depending on the project type.
Reference link:
Visual Studio "Unable to start debugging on the web server. The web server did not respond in a timely manner.".

ASP.Net Core 2 - IIS 502.5 Error

I am creating an ASP .Net Core (2.0) MVC application within Visual Studio 2017 which was working absolutely fine.
After turning off my computer yesterday and coming back to my application today, I now receive this browser error when I start the application in chrome without debugging.
Running dotnet run within the directory of the application, I can access the site just fine. It is just when I run it via Visual Studio/IIS Express I get this error.
HTTP Error 502.5 - Process Failure
The application builds and compiles just fine. I have also cleaned the solution.
Looking in the event logs I find:
Application 'MACHINE/WEBROOT/APPHOST/MYAPP' with
physical root 'C:\Users\Ben Hawkins\Desktop\Development Folder
\Dev\Website\Version_2\MYAPP\MYAPP\'
failed to start process with commandline 'C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Web
Tools\ProjectSystem\VSIISExeLauncher.exe -argFile "C:\Users\Ben
Hawkins\AppData\Local\Temp\tmp3547.tmp"', ErrorCode = '0x80004005 :
0.
Within my output window in Visual Studio 2017 I recieve this message under
ASP NET CORE WebServer
Failed to initialize CoreCLR, HRESULT: 0x80131534
What I have tried:
Cleaning the solution, rebuilding etc
Restarting the computer
Trying to launch another application. (Same result)
Created a new application from scratch. Same result.
Repairing Visual Studio Community 2017. Same result.
Stopping/Closing IIS Express
My setup was working perfectly yesterday and suddenly is not.
Thank you for your time. I hope we can find a solution.
We finally found the issue! After logging on to the machine as a different user, we saw a warning that the main user had ignored initially. There was a 0 byte file in the root of the directory named "Program" with no file extension. It appears that this causes some sort of issue when VSIISExeLauncher.exe is invoked through Visual Studio. (Note it would work if executed from the command prompt). After deleting the file, everything worked!
We do not know how this file was placed there for certain, but suspect it was some sort of copy error when the user was pulling in files from his old hard drive.
I don't know if anyone else will come across this, but if so hopefully this helps!
Maybe you need install previous versions of .NET Core, isn't it? I installed here and it works now. I had only .NET Core 2.0 installed and I realized that applications with 1.1 stopped so when running. In Windows' event logs I've had the same error registered.
Try to change the IISExpress to IIS by creating new IIS profile and change the Lunch to IIS. It resolved my problem.
I have hit a very similar issue with ASP.net Core 2.0. I had copied my VS project to a new one, and I was getting this error message.
After doing some research, I was able to determine that the nlog.config file was not copied into the bin > Debug > net461 folder. Once I did this, I was able to run my application.
I found it by running dotnet run from the command line on my project where the csproj files live.
Had same issue yesterday (windows 10).
Solved it this way:
Update Microsoft.AspNetCore to latest (Nuget manager - 2.1.3)
Make sure the sdk also updated to latest version. if not, update it manually from Nuget console like this:
Install-Package Microsoft.NETCore.App -Version 2.1.3
Download and install latest ASP.NET Core/.NET Core: Runtime & Hosting Bundle
from here
Same problem with version 2.2. Reinstalling .NET Core SDK fixed the problem for us.
In my case, my project was setup as a website in IIS and the file "bin\IISSupport\VSIISExeLauncher.exe" was missing in the project's directory.
I simply selected "IIS" when debugging the project in Visual Studio 2019 and it generated the missing file. It also generated 2 text files (IISExeLauncherArgs.txt, pidfile.txt) in the IISSupport folder, made changes to my web.config file, and my project ran successfully.
After that I was able to access the local website that was setup in IIS without running it in Visual Studio.

Debugger For Visual Studio is not Working

I am facing a very serious issue with visual studio debugger. My asp.net application is hosted on local IIS server. Yesterday i was debugging my code suddenly it stopped working. I verified w3wp process. It was same as IIS process. Then i tried to download symbols but i am not sure either they are all that i need. I tried attaching debugger on visual studio 10 and visual studio 12. Neither of them is working in this case. I tried to attach debugger of JavaScript but it is also not working.
Please Help.
Are you building full debugging symbols? If not then the debugger has no information to relate the source code to the in memory activity under the debugger. This is set in the project properties per configuration.
Also ensure the symbols are in the bin folder.
You can validate that VS is loading the right symbols with the Debug | Modules window.
I cleared temporary cache of .NET Framework. then i again deployed my application on IIS with different name and magically everything started working.

Cannot run any web application in VS 2010/2012 getting "Unable to start program"

Since this morning I cannot run any web application in Visual Studio 2010 or 2012, getting the following error:
No break points are being hit in the Global.asax. I thought there's some issue with dll's I'm referencing so I tried creating a clean new web forms and MVC-4 applications using both 2010 & 2012 but still getting the same error
Try going to http://localhost:2980 in your browser without debugging in Visual Studio. It should give you a more accurate error.
Some other things to try
delete your bin and obj folders (Clean your solution)
restart Visual Studio or even your OS
restart IIS
run aspnet_regiis -i
some more things to try
if you installed web express first, http://forums.asp.net/post/5373941.aspx
try running visual studio in repair mode
Seems like there's a problem with Internet Explorer(I'm using version 10) If i run the site in Chrome or Firefox it works fine

Visual Studio 2012 Error

I use Visual Studio 2012 on a Windows 8 PC. I had no problems when installing VS2012.
When I'm working on a ASP.NET c# project I usually use the option "See in the explorer" instead debug the project. This gives me the ability to change code behind.
Sometimes after build and press F5 to reload the page I get some errors. This doesn't happend always, but very often.
The errors are: CS2021, CVT1100, CS1566...
"Can't find file 'C:\Users\UserName\AppData\Local\Temp\Temporary ASP.NET Files\root\617be439\61539075\App_GlobalResources.iuxkzxdi.0.cs'"
Always the "C:\Users\UserName\AppData\Local\Temp\Temporary ASP.NET Files\root" is the problem. Sometimes it says can't find file others it says access denied.
Visual Studio works but is horrible to keep pressing F5 until the error goes away.
Can anyone help me?
Run VS2012 as Administrator. Local account by default have restriction accessing the build/temporary locations and will throw such errors. You'll have similar problems when trying to publish websites.
Therefore, It is easier to set VS 2012 once, and check the box in properties to "Run program as administrator" to allow it run always as "Administrator".

Resources