.NET 4.0 WebAPI on IIS6: Starts returning 404 until ApplicationPool restart - .net-4.0

We have a .NET 4.0 ASP.NET WebForms website and mixed ASMX/WebAPI webservice deployed to a Windows Server 2003 IIS 6.0 instance that is suffering from 404s being retuned from the WebAPI controllers for various periods of time.
The WebAPI controllers are in the same project/site as the ASMX service, however, the ASMX service has no issues. Both the webservice and WebForms website are hosted in the same ApplicationPool, though are separate IIS sites.
A snippet of the IIS logs is below, where the WebAPI service seems to recover by itself :
When this error has occurred recycling the ApplicationPool has done the trick, though sometimes it appears that an ApplicationPool recycle actually starts the problem. It has happened once or twice immediately after a recycle after a new deployment. A second recycle fixes the issue. I have turned off periodic ApplicationPool recycling to see if this stops the issue.
I am not really sure where I should be looking from here...

Related

Can I run .Net 4.6 Application under .Net Core Site on IIS

I inherited a project that is a collection of WCF Services that target .Net Framework 4.6.1. I wrote a front end SPA application that targets .Net Core 2.2 not realizing that the hosting model was such that both the UI (.Net Core) and the API (.Net 4.6.1) need to run under one Site on IIS.
I'm trying to get this to work on my local machine. I created a new Site in IIS -- Site A. I published my .Net Core application to Site A and set it up with an application pool set to "No Manged Code".
I then added an Application to Site A called API and added all my WCF services in that folder. I configured API to use an application pool that targets ".NET CLR 4.0".
I updated the web.config in the root of Site A to include all the necessary bits for WCF.
I'm able to hit Site A and get my SPA UI, but when I do anything that attempts to hit the backend API (including trying to hit it directly -- http://localhost:464646/api/test.svc), I get the following error:
HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure
Is what I'm doing even possible? If so, what changes do I need to make in order to get this to work?

Logging (W3C logs) with IIS with.net core app (No Managed Code)

Is it possible to use IIS's logging with an asp.net core application? We've developed several .net core applications and they are all hosted under IIS so I'm trying to take advantage of IIS's logging.
Unfortunately, enabling logging with a No Managed Code app seems to produce no logs. Managed Code applications do produce logs correctly.

How to host .Net Core service in IIS without service being recycled

I have a .Net Core Service with a WCF Relay Endpoint. This service needs to be up and running all the time. I do not want to host it as Windows Service, until I'm 100% sure, it is the only solution.
I tried to setup ApplicationPool with "StartMode=AlwaysRunning", "Idle Time-out (minutes)=20" and set Recycling to "Regular time interval(in minutes)=60" but it did not help. Maybe, it is only working for Asp.Net Apps with global.asax events: https://weblog.west-wind.com/posts/2013/oct/02/use-iis-application-initialization-for-keeping-aspnet-apps-alive
Any idea? Thank you.

MVC Mini Profiler on IIS 6

Has anyone been able to get the MVC mini profiler working on IIS 6? I've set up the profiler in my application and it works perfectly in Visual Studio, IIS Express and IIS 7.5 but when I put the exact same application onto IIS 6 it won't work.
The problem seems to be around loading /mini-profiler-includes.js, I just get a 404 response. I've checked the route table and the correct routes have been registered by the profiler but apart from that I'm not sure what else to try.
On IIS 7, ASP.NET by default runs in integrated mode so the ASP.NET runtime will handle all requests, however on IIS 6 ASP.NET only handles extensions explicitly listed in the mappings section.
When the request comes in for /mini-profiler-includes.js IIS sees the .js and tries to serve the static file but as the file is "generated" by ASP.NET the handler never gets hit and a 404 error is returned.
In order to fix this you need to add a wildcard mapping to IIS so all requests get handed to ASP.NET. This blog post has a good walkthrough of the process.

Can I host a wcf 4.0 website in IIS instead of as an application in IIS?

Most examples I see about hosting WCF in IIS have you create an Application under an existing website. I have a website in IIS, but the website uses a .NET 2.0 app pool, so I can't host the service as an application under the website. Is it better to create an empty website to just host the service or to create an empty website and then create an application under that empty website to host the service?
I have WCF running as a WebSite in both IIS6 and IIS7, and they work fine. They basically work exactly the same as any ASP.NET site; the .svc files are conceptually similar to .aspx pages, in that IIS calls over to .NET to process them, and all the core WCF stuff is in the assemblies in \bin. The web site is assigned to an App Pool where the actual processes run, just like a normal ASP.NET site. I don't think you need to make an 'Application' in IIS.
You don't need a new website - you can still host WCF in a 2.0 application pool - but in your project you'll need to set the target framework version to 3.5, instead of 4.0.