why dotnet.exe is terminated under IIS - asp.net-core

Introduction
I do have WebApi on.Net Core 1.1 & simple test application executing some scenario with calls to my API in multiple threads. Web API is hosted under IIS on WS 2012 R2.
Problem
When I do start my test application with 20 threads in 20-30s test application begin to receive 401 error from the server. After some investigation, I've noticed that dotnet.exe process is suddenly terminated & restarted on the server on high load.
There is no information neither in my logs nor in Windows event log (only one from IIS AspNetCore Module about starting new process: Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE' started process '10248' successfully and is listening on port '23570')
I've tried to reproduce this on my machine without any success - this does not happen when my API is hosted in IIS Express from VS.
Question
What may be the reason?

Related

Keep .NET 5 Web API running all the time in IIS

I have .Net 5 Web API hosted on IIS 10.
I configured IIS Application pool and IIS Site as mentioned here.
Install server feature - Application Initialization Module
Set the Start Mode to AlwaysRunning
Set Preload Enabled to True
Set the Idle Time-out (minutes) to 0 (zero)
The problem is - When I reset IIS(iisreset), app is not initializing. I see only app is shutdown in logs.
2021-10-26 16:35:16.5366|INFO|Microsoft.Hosting.Lifetime|Application is shutting down...
2021-10-26 16:35:16.5366|INFO|Quartz.Core.QuartzScheduler|Scheduler QuartzScheduler_$_NON_CLUSTERED shutting down.
What am I missing?
Finally I figured out that for "Preload" = true on the Web Site to work you should activate anonymous authentication on the web site.
If anyone knows how to fix this for Windows Authentication only, please add your answer.

Will publishing code to production IIS server interfere with running http requests?

I would like to ask if it is save to publish .net core web project to production IIS server directly through WebDeploy or Folder publish profile.
What about already running http requests ? Would it be better to stop the IIS website first, update codes and start website again ? But I don't know if stopping the IIS website will wait for running http requests or stops them by force. Does the publish profile handle this by default (for example it happens often with folder publish profile that files are being in use by IIS process and the publish operation fails) ?
What is your publishing process, do you stop the website instance ?
The configuration file will be saved when directly publishing the .net core project to IIS.
When publishing a .net core application, the web is not running in iis, but as a separate out-of-process console application, using Kestrel components. AspNetCoreModule is hooked to the IIS pipeline early in the request cycle, redirects all traffic to the following Core application, and all requests are forwarded to the Core process.
Requests come in from the Web and int the kernel mode http.sys driver which routes into IIS on the primary port (80) or SSL port (443). The request is then forwarded to your ASP.NET Core application on the HTTP port configured for your application which is not port 80/443. In essence, IIS acts a reverse proxy simply forwarding requests to your ASP.NET Core Web running the Kestrel Web server on a different port.
So I suggest you stop the website while publishing and restart it then. Files in the deployment folder are locked when the app is running. Locked files can't be overwritten during deployment. I recommend that you take the original application offline when you publish a new web, which is also recommended by Microsoft. More details can refer to following documents。
Taking an Application Offline before Publishing.
Locked deployment files

IIS, application pool stop Automatically

I am running WCF services on IIS 7.5 with .NET framework version 4.5 and it is in integrated mode. Whenever I deploy new code on IIS, it causes application pool to crash resulting in 503 error. I tried to dig into code but I am not able to figure out the root cause of the problem because of the large code base. I have ensured that it is not because of any server or IIS setting (as reverting the build makes IIS normal). I have also looked into event logs but not able to find anything, I am already logging application error but nothing is helping. Is there anyway I can trap the event or error just before crashing pool as I am running it integrated mode? Any help will be appreciated.

ASPX.NET Core - random 502 error on IIS server

We just launched a site that runs on ASP.NET Core 1.1, Windows 2008R2, IIS 7.5 with all the latest patches to 2008 and asp.net.
The site runs fine, but goes down with no apparent pattern. All of a sudden it would start returning 502 response:
502 – Web server received an invalid response while acting as a gateway or proxy server
Restarting the site in IIS, or recycling site’s application pool brings the site up, but the problem reoccurs within a few hours. As workaround, we configured IIS to recycle app pool every 90 minutes, and that seemed to keep the site up all of the time.
Any recommendations on how to troubleshoot this problem?
Thank you!
IIS says with this 502 error that Kestrel (behind it) returned something "wrong". Enable (more) logging, and inspect logs before first 502 response. Some previous request "breaks" your app.

WFC SVC File emits HTML when called from a service client

I'm in the process of deploying a WCF service application. The service works fine if it's running as its own site, but the intention is for the service to run as a virtual directory of the Default web site of the server. When I set the service up in this configuration, I get an odd problem. When the client tries to make a service call, it receives the HTML of the friendly service description, not SOAP. Naturally this generates a service error. The HTML appears to be identical to the service page that you see in a browser with an HTTP Get, but I'm only seeing the first 1024 bytes in the error message, so I may be missing something.
I've checked HttpHandlers and loaded assemblies, and as far as I can tell there's nothing unusual that is being inherited by the virtual directory. The default site has 3 ISAPI Filters installed including Outlook Web Access (yes, this server is running Exchange). I tried installing these filters in my test web site, but it still ran the service without problems. The problem only happens with the service is running as a virtual directory of another virtual directory within the default web site.
The server is Windows Small Bus Server 2003 SP 2 running IIS6.
If you're hosting WCF in IIS you need to set the server up in the 'Application Role' check out the following link does that help:
MSDN: Internet Information Service Hosting Instructions