App pool crash : IIS Express vs Local/Server IIS - c#

I have improved some external dll in a web API application. If I run it using Visual Studio's IIS Express then it works fine. But if I depoy it to local or server IIS then App is crashing the App pool. Is there any way to find the problem?
Application is crashing, when I call constructor of external dll.

I changed app pool settings on local/server IIS.
Open IIS - Application Pools - select your application's app pool - advanced settings
Set
Identity : LocalSystem
Rapid-Fail Protection - Enabled : False
I don't know how but it fixed my issue.

Related

IIS Application Initialization doesn't start my C# .net 6.0 application

I want my C# .net 6.0 application to auto start after server restart or after application pool recycle. I am using clean architecture and react as a frontend. I have published my application on ISS, enabled auto-start, but application doesn't load without opening it's site on a web browser.
I have published my .net 6.0 application on production environment, which consist of:
Windows Server 2016 Datacenter
IIS version 10.0.14393.0. (I have installed Application Initialization feature).
On Appliction Pool of my app i have:
apppool settings
On Site of my app i have:
appsite settings
Problem is: I can't start or auto-start my app without opening its url on web browser. Without opening browser I can't even load my Program class with Main method. I want my app to load with IIS after shutdown or after recycle automatically without needing me to open it's site on browser. Maybe IIS could open my app site automatically. Inside my app in Startup I have some quartz jobs, that will load for now only after I opened my app site in browser. Without opening my app in browser Startup doesn't even load.
I tried Any way to start IIS App (Website) automatically?
but adding InProcess haven't worked.
I tried asp.net application does not auto-start
but System.Web.Hosting.IProcessHostPreloadClient is not available in .net 6.0. Also var client = new WebClient() is obsolete and doesn't work
I have similar problem like described in comment
How to properly autostart an asp.net application in IIS10
I want my app to auto start while being on IIS. Maybe IIS could open ap site? Maybe in launchsettings.json there is an option, to load app without opening browser?
Thank you for your help in advance

How to configure Com+ .net Assembly called from classic ASP to run under AppPool User

I have a very specific scenario: A classic ASP application is running a .Net Assembly through COM+. It's working, but I'm having problems regarding which user the DLL is running under.
In my staging server, both w3wp.exe process and the .net DLL are running under AppPool user : IIS AppPool\AppPoolName. But in the production server, w3wp.exe is running under AppPool user, while the .net DLL is running under NT Authority. I need it to run under AppPool user so I can configure permissions to a folder the DLL needs to write to.
I discover the user the DLL is running under calling Environment.UserName in C# code.
Some things I've already tried and checked:
My app is running on a custom web site under iis (Not DEfaultWebSite), with its bindings properly configured to http 80.
The web site is running on a exclusive AppPool.
The AppPool is configured to Integrated pipeline
The AppPool is configured to use Identity: ApplicationPoolIdentity
IIS \ MyWebSite \ ASP \ ComPlus Properties, the settings on production server are the same than staging server.
In Task Manager, w3wp.exe process is running under AppPool user.

IIS settings for OutOfProcess .NET Core Application

I would like to try OutOfProcess hosting for .NET Core Web App (.NET 5) in IIS 8.
I thought all I need to do is to change hosting model to outofprocess in web.config and IIS will forward request to Kestrel which would host the app.
When I use inprocess hosting model, website is accessible at http://localhost:8080/Test2.
When I change hosting model to outofprocess http://localhost:8080/Test2 returns HTTP error 502.5 as captured on screen below. Manually starting the app from command line with
dotnet myApp.dll
makes application available at http://localhost:5000 but I would like to access it thru IIS port.
What do I need to do to access .NET Core App thru IIS when App hosting model is outofprocess?
I've installed hosting bundle for .NET5 and .NET6.
I restarted IIS after configurations change.
I've set folder permission for application pool account, also for
"everyone" group.
Reading MS documentation I guess it is not possible to host application like this without modifications to app source code and publishing it again. To be honest I don't understand this article entirely.
Current host settings [Windows Server 2012 R2]

MVC Authentication not working in IIS (works in IIS Express)

I have created an MVC project with individual authentication and am using the default template. When I launch the application from within visual studios (IIS express) I am able to view all the public pages, register an account, and login. Everything works great.
However, When I publish the project and host it on a full IIS server (on Windows Server 2016) I can view all the public pages, but registering or trying to sign in yields the following generic error:
I am using the LocalDb for the project and I noticed that the windows Identity on the deployed applicaiotn is "NT AUTHORITY\SYSTEM" while the IIS Express application's is USER-DESKTOP\User. Is this error being caused by a permissions issue and if so how do you fix this?
Also, is it bad to use localDB for a deployed project? There will only be two users using the application and they are both trusted.
It is totally not good idea to use localDB for a deployed project,
it is meant for developer testing only.
when you start debugging in vs the localDB is started.
its better if you use SQL Express
https://go.microsoft.com/fwlink/?linkid=866658
Try to set your site application pool identity to the local system by following the below steps:
1)Open iis manager
2)Go to the application pool and select your application pool name.
3)Click on the advance setting.
4)There is a "Process Model" option, under which there is an "Identity" option. This is by default the application pool identity. Change it to Local System, and you're done.
Set “Load User Profile” to True.

MVC .NET Web service no access to Sharepoint Site on deploy mode

I'm developing a web service MVC .NET application that access to a Sharepoint 2013 site, I'm using the Microsoft.Sharepoint.dll not the client dll. When I run my web service on VS2015 in the IIS Express in release and debug mode I don´t have any problem, but when I deploy the app to my local IIS the web service return an error
The Web application at http://[URL to SharePoint]/ could not be found.
I've tried running it with different URL such as http://localhost/sites/mysite and by domain name http://domain/sites/mysite, and I got the same results, on my VS IIS Express runs without problems but on the deploy IIS not.
The app is running on Framework 4.5 and AnyCpu compilation, I've tried downgrading the framework to 3.5 but without success. What could be the problem?, Is there any special permissions on the VS IIS that I need to enable on my local IIS?
I resolved deploying my application on a new web site in the IIS with the same applicattion pool used by my Sharepoint web site

Categories