ASP.Net Core 2 - IIS 502.5 Error - asp.net

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.

Related

.NET Core 31 - Single EXE - The application to execute does not exist

Converted an old .NET Framework project to .NET Core 3.1 yesterday. The application runs fine on my own machine and debugs correctly.
I have put both the following into my .vbproj/.csproj
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>win81-x64</RuntimeIdentifier>
However when I move the .EXE to a remote machine and attempt to run said EXE on that remote machine I get told that the DLL (for the project in question) does not exists.
I moved the .dll to the same directory that the exe is in (not ideal) and get the following error instead
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet'.
I used to use Costura.Fody to create a single file exe without any issues in .NET Framework, I was under the impression the above would do the same for the .NET Core packages.
Can someone point me in the right direction please.
For anyone else that may find this question and find it useless.
I was 'Building' the project instead of 'Publishing' the project, this in-turn wasn't creating the self-contained exe properly.
Don't be a donut like me.
In Visual Studio 2019, go to Build > Publish MyApp. This will open a tab in the editor area. Click on Show all settings to open the Profile settings dialog. Then click on File publish options and check Produce single file.

Process with an ID of #### is not running. output says: "The program '[4560] iisexpress.exe' has exited with code 0 (0x0)."

so I was previously using VS2015 in Windows 10. I had built one simple ASP.NET MVC project and never faced any issue while running it. However, I have been using Windows 8.1 now and installed VS2019. Running the same application and been facing the error "Process with an ID of #### is not running".
output says: "The program '[4560] iisexpress.exe' has exited with code 0 (0x0)."
So I tried to open a new dummy ASP.NET Web MVC project to check if that works and it didn't.
Now, there are a myriad range of solutions provided all over and I have tried every last one of them. With no luck.
1. Delete the hidden .vs file.
2 Rename/ remove the IISExpress folder and its config file under documents.
3. Removed the specific code snippet from the solution .csproj file
4. Of course tried running VS as ADMIN.
5. Realised that IIS exress was not installed. So completed that.
6. Then realised that VS 2019 needed to have the IIS support for ASP.net core installed additionally, so done that.
Now I'm out of ideas. It would be really helpful if you could provide some more suggestions or work arounds for this problem.
Thanks.
So, what finally worked for me were the following steps:
Install IIS using this link -
IIS Manager in Windows 10
Run the IIS from command line by following this link -
https://learn.microsoft.com/en-us/iis/extensions/using-iis-express/running-iis-express-from-the-command-line
Opened VS 2019 in admin mode.
Project -> (right click)Properties -> Web -> Servers -> Select local IIS from dropdown. -> Create Virtual Directory -> click ok. -> ctrl+S
Run the application.
I was getting same issue. This problem can be resolved by explorin project directory and remove the .vs hidden folder.

Error while Publishing Web App in Visual Studio Professional 2013

I am trying to publish my Web App in Visual Studio Professional 2013 but getting the following error
I got the same question asked over here but no useful answer.
Can anyone please help
You probably will be using older version, that was having an issue. refer detail [here]
Install the newer web deployment tool, should work.
which .net version are you using.
check web deploy version. if vs has 2 web deploy version, the vs get confuse to take which version. If it has 2 version, just uninstall vs and then instal it along with web deploy. if the Vs has one 1 web deploy version, you uninstall and install the web deploy. It will rectify your problem i hope.
You can refer This link
Check if version 9.0.0.0 of the assembly is installed in GAC. (from the VS2013 developer command prompt) gacutil /l Microsoft.Web.Deployment. Issues like this have occurred in the past where things worked, then after installing an update (or trying to install one) then reports of missing dlls, like nuget, occur.
The usual course of action is to repair the Visual Studio installation.
There is a problem with your publish profile. Delete the pubxml file located bellow Properties folder in your project and then create a new publish profile.
I got the same problem when older project runs into the new .NET Framework, for that you have to do the following.
Right Click on your project name->select Property Pages -> Click Build from the menu-> then select Target Framework .Net framework 4.5 or your current using framework..
"Could not load file or assembly" means the required file (of that mentioned version) is not available in the assembly (nor in the registry). All you gotta to do is to ensure this same is installed properly that would allow you to proceed further. The other things to ensure is the latest framework installed on your system.
Think you have some errors happen when to install or update Visual 2013, so you can reinstall again and this error will be fixed.

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.

ASP.NET web app not deploying correctly on Windows server 2012

So here's the thing. I recently updated a web project to use nuget for its dependencies, which in turn updated all of those dependencies to the latest versions.
Quite a task as there were some breaking changes, but I have the thing running locally perfectly.
We use TeamCity to pull the solution from bitbucket and deploy it the the local iis folder on a development (staging) server.
After a build, the website seems very poorly, first off it complains:
Could not load file or assembly
'file:///C:\web\Dev.Pegfect.Presentation\bin\mscorlib.dll' or one of
its dependencies. An attempt was made to load a program with an
incorrect format.
Which is strange since my local copy does not have a copy of mscorlib in its web bin folder. Should be using the GAC? If I remove the dll, I get a new error (some NHibernate issue complaining about reflection). I haven't pursued that since it all seems environmental.
If I copy my local bin folder over the server web bin, it starts to run ok albeit extremely slowly (relative to how it used to).
So, the question "what have you tried" - i am currently installing VS 2012 onto the server and will try building the project from source directly. I am also considering updating TeamCity from v7 to v9.
I could also try to reinstall IIS8.0 on the server.
These are desperate, blind shots in the dark. What would you try?
FWIW the project is targeting .NET 4.5.1 (ANY CPU)
OK, so I will leave it here as it might help someone.
So, the project has been building, deploying and running successfully on the server compiled to .NET 4.5.1 with no problem.
The recent packages update moved us from MVC v4 to MVC v5. (amongst other things). Running .NET fix tool suggested 4.5.1 was corrupted, so I downloaded the developer version and installed and now its fine.

Resources