unhandled microsoft .net framework exception in w3wp.exe - c#

I am writing a console application which uses a workflow service.
I tried to attach the visual studio to IIS process to debug my application in two visual studio console but it didn't work and after that when I try to do something with my service ( update the service, build the service, open the service in browser and etc) just in-time debugger pops up:
An unhandled Microsoft .net framework exception occurred in w3wp.exe[every time diffident number here]
P.S. I have a running service in IIS and before changing setup I didn't have any problem but now even after restarting I still have this problem.

Restart site in IIS and also restart app pool worked for me.

Follow below article for more information. I solved this issue by running visual studio as Administrator.
http://anishantha87.blogspot.com/2014/09/an-unhandled-microsoft-net-framework.html
Hope this will help!

Related

500.30 - ASP.NET Core app failed to start running in Visual Studio

The dreaded error has been plaguing me for days...
Running:
.net core 5.0.409
VS Professional 2019
Windows 10
When running from command line (dotnet run {project}.csproj) everything runs just fine, but when running from Visual Studio on IIS Express I receive the 500.30.
No breakpoints are hit in startup or program.
Event log is unhelpful: "Application {name} hit unexpected managed exception, exception code = '0xe0434352'. Please check the stderr logs for more information."
I cannot for the life of me get stdout logging to work.
Nothing useful in the Output logs.
This works fine in VS on other machines.
I can't quite explain why this worked, but upgrading VS to 2022 sucessfully resolved the problem. However, one indication that led me to this solution is that the application was developed using 2022 and I was trying to run on 2019.

Runtime Error with Deployed ASP.NET Core MVC app; doesn't occur during debugging in VS '19

I have an app that I've been building and running in Visual Studio. I've been doing fine, until today when the deployed app suddenly won't load a specific page. When I run the app through VS in debug mode, all is well.
But when I run the app and try to load a specific page, I see the following error in the Application Event Logs:
ActionName: MapItGo_Web_App.Controllers.ShippingSchedulesController.EditRelayCalendar >(MapItGo Web App)
The view 'EditRelayCalendar' was not found.
Searched locations:
/Views/ShippingSchedules/EditRelayCalendar.cshtml,
/Views/Shared/EditRelayCalendar.cshtml,
/Pages/Shared/EditRelayCalendar.cshtml
The page exists. And like I said - when I run the app in the debugger, it runs fine. This is totally bizarre to me. It was running completely fine this morning, when I had a colleague testing that particular page out.
This app is being deployed to MS Azure.
Any ideas?
I had tried with Asp.net core MVC application deployed using Visual Studio 2019. I am not facing any issue like Runtime Error.
Please try to clear cache the solution, rebuild the solution and try to deploy into azure. If you still have an issue please raise a support ticket New support request - Microsoft Azure
Refer for more info here

HTTP Error 502.5 - Process Failure when application is run from Visual Studio

I've seen this post, but it is not my case cause I run my project from Visual Studio. It is not a deployed application.
I've recently installed Visual Studio 2015 Professional Update 3 and I am running locally ASP.NET Core Web with AngularJS 2 application.
What I see is error when I run application is:
HTTP Error 502.5 - Process Failure
Common causes of this issue:
The application process failed to start The application process
started but then stopped The application process started but failed to
listen on the configured port
I've already installed the follwing packages at my PC:
DotNetCore.1.0.0-VS2015Tools.Preview 2
DotNetCore.1.0.1-VS2015Tools.Preview2.0.3
DotNetCore.1.0.4_1.1.1-WindowsHosting
dotnet-dev-win-x64.1.0.1
dotnet-win-x64.1.1.1
Does anybody know how can I resolve this error?
That was my silly mistake. I should just not run my application immediately, but at first try to debug my application!
When I tried to debug my application, then I saw the following exception:
Can't load Microsoft.AspNetCore.Hosting 1.1.0.0
Then I just corrected dependencies project.json file and it started working very well.
Thanks a lot, guys, to all!

Visual Studio Professional 2012 , will cause the CPU to reach 100% and the VM will hang then get restart

I have my development environment as follow:-
Visual Studio 2012 Professional. version 11.0.50727.1
Windows Server 2012 R2.
asp.net mvc4 web application.
now since last week i am facing these problems:-
when i run my asp.net mvc web application inside visual studio, i will receive the following error, when i access my asp.net MVC home page:-
500 Internal Server Error
after many runs, the CPU will reaches 100% and my development machine will automatically get restarted. now i check with our system admins and they mentioned that the VM got restarted because of high CPU...
so i am not sure if the problem is within VS 2012 , or within the VM itself.. baring in mind that the VM host some test applications inside IIS,, and we can access these application without any problem. also i can open the sql managemnt studio and work with the DBs without any problem. so before asking to expand the DEV machine specifications to avoid high CPU , i want to make sure that the problem is not within Visual Studio itself ??
here is 2 screen from the server manager after the VM got restarted :-
now i am not sure how i can fix this?
Thanks
The 500 Server Error is the standard error report from IIS if an MVC application throws an unhandled exception. So your code inside your MVC application is faulting somehow.
If this occurs you would normally run your site in debug mode in Visual Studio to trap the exception and debug out the problem. I have not idea what your application actually does but I can speculate the following possible cause;
1) IIS receives your call.
2) The MVC code generates a high CPU load doing some faulty code.
3) The calling application times out its HTTP call, and calls again.
4) Another IIS Instance is created to deal with the new HTTP Call (depends on your IIS Setup)
5) The second IIS instance does the same as (2) but in a different thread, causing more resource consumption.
Eventually you get a 500 server error as one of your IIS instances times out or throws and exception. Your "helpful" sysadmin kills your VM.
The killing of the VM is entirely uneccessary - IIS has perfectly adequate safeguards against runaway IIS processes, including IIS Application Pool timeouts, automatic IIS Application Pool recycling, IIS Application Pool CPU Throttling, and IIS Application Pool maximum memory usage. All of these configuration options prevent the operating system from being destabilised by a runaway IIS application.
Without any insight into what your website does in the background we cannot go any further, but if you mod your question and give some of the MVC code its possible something might be spotted.
I had a similar error with Visual Studio 2013. The error turned out to be one my Addins. If you are using add-ins, try disabling the suspected plugin from the Tools --> Add-in Manager..., then restart Visual Studio. If you are using extensions try reviewing those as well from Tools --> Extensions and Updates...
You can optionally choose to run Visual Studio in Safe Mode which will essentially do the same thing but will disable all plugins. devenv.exe /SafeMode
Hope this helps.
I had some similar issue in Windows Server 2012 running Visual studio 2012.
Upgrade your Visual studio and Windows server both. It will solve the issue

Windows Service in C# works on dev machine, crashes in test environment

I have been working on an application using .NET 4 and c# in Visual Studio 2010 Express. It's purpose is to watch a directory and import any documents it finds into our imaging system.
I included an installer class which provides the information needed by installutil.exe.
So to install locally, I build the solution, and then at command line:
installutil.exe MyProjectExecutable.exe
Which installs it as a service. This works fine in my development environment.
To deploy to the test environment, I use the same method:
installutil.exe MyProjectExecutable.exe.deploy
Except of course the executable has a second extension, .deploy. This is the way the application is published by Visual Studio. Everything works up tot his point
Here is the problem: once I have done this, I run the service and it starts properly, as indicated in the log file. However, once it detects files in the directory, the service will not do anything with them and will eventually crash. The only way I can tell it has crashed is to look in the windows Event Viewer. It will show the message:
"An unhandled win32 exception occurred in MyProjectExecutable.exe.deploy [4108]. Just-In-Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on."
Two questions:
1) What could be causing this
2) Am I going through the correct steps to install a windows service, or is there a better way?
Both environments have .NET 4 installed.
In both environments I am placing the same documents in the import directory.
In both environments the service runs under the Local System account.
If my question reflects a lack of C# experience, my apologies in advance.
subscribe to AppDomain.UnhandledException Event
Are you watching a directory under 'Documents and Settings?' You mention that you're running under Local System, but is that in the C# code or in the Services Panel?
Start->Run
services.msc
< Find your App >
Right-click, Properties
Log On Tab
Log On As
This Account
< Plug in a user / pass with permissions >
In my experience this it is always a security problem. Check the rights that the service running user has. Can it access the folders you are monitoring and make the needed changes?
I have found the problem. in the config file, the listen directory was "c" whereas it should have been "C". Until now, I didn't think Windows was case-sensitive. Thanks for the help guys.

Categories