.Net Core Upgrade To 5 - Version doesn't map to a known HTTP protocol - asp.net-core

We upgraded our asp.net core 3.1 web app to version 5. It's hosted in IIS. All servers are fine. We go to production and we can't stay stable because of the following error at the bottom. Just flurry of errors so we had to roll back until we can resolve this issue.
Looking at the breaking changes from 3.1 to 5 - I'm still not spotting anything. Looking at the Microsoft source code I'm still not sure how the error would come about. Any help would be appreciated.
An unhandled exception was thrown by the application.
System.ArgumentOutOfRangeException: Version doesn't map to a known HTTP protocol. (Parameter 'version')
at Microsoft.AspNetCore.Http.HttpProtocol.GetHttpProtocol(Version version)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.get_Protocol()
at Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.IsEmptyHostAllowed(HttpContext context)
at Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()

Related

How manage "wkhtmltopdf" on .NET Core Api on IIS

I have a .NET Core 3.1 API calling wkhtmltopdf.exe to generate a PDF (using RotativaCore wrapper).
Its working fine with moderate usage... The problem when I have too many request at same time ...
Several 'wkhtmltopdf.exe" will stuck on Windows processes and I start to get several errors:
QEventDispatcher: Failed to create QEventDispatcherWin32 internal window: 87 Qt: INTERNALL ERROR: failed to install GetMessage hook This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
How can I handle that?

Updating to .Net Core 3.1.12 caused 3.1.0 sites to break

Over the weekend our webserver was updated, and after that our website went down with the error "HTTP Error 500.31 - ANCM Failed to Find Native Dependencies", and we received this error message in the event log on all sites using .Net Core 3.1.0:
"The framework 'Microsoft.NETCore.App', version '3.1.12' was not found."
When we uninstalled 3.1.12, the sites came back online.
Is there a way to allow for .Net Core updates without sites going down?

HTTP 500 error launcing ASP.NET 3.0 application

I have just upgraded our ASP.NET Core 2.2 web application to 3.0. It builds and deploys fine. The problem is when I go to run it from our IIS server. This was running perfectly fine as a Core 2.2 web app, but now fails since upgrading to Core 3.0.
When I launch the web app from the commandline there are no reported errors.
When I launch the application from the browser the Windows logs indicate that the app started correctly.
The app then fails with an HTTP 500 error. Here are the IIS log entries.
We're using Windows Server 2012 R2 with IIS 8.5.9600.16384
The app appears to start correctly but then fails with an HTTP 500 error. Has anyone else seen this or something similar? Any ideas how to diagnose / fix the problem?
UPDATE
I've attached the VS 2019 debugger to the deployed app via the w3wp.exe process and it's not even hitting any of the middleware (I have a breakpoint at Startup() in Startup.cs).
I've tried changing the application pool settings e.g. identity, .NET version but to no avail.
When I launch the site from the web server I get the following error message which doesn't really tell me anything.
I can't see what's causing the problem.
.NET Core 3.0 uses the in-process hosting model by default. You may need to upgrade the .NET Core Hosting Bundle.
You will check web.config "aspNetCore"
<aspNetCore processPath="dotnet" arguments=".\Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
maybe proccessPath is wrong.
if it doesn't solve problem , write to log step step startup.cs.
Maybe throw error in startup.cs
After investigation and comparison of the build artifacts that the build produces vs the deployed app, I discovered that the appsettings.json was not being deployed. No idea how or when this started failing, but it caused the app to generate an HTTP 500 error message. Our app's Azure ADB2C settings are contained in this file so it was crashing trying to authenticate but couldn't find the authentication settings.
There was no obvious error being generated and everything seemed to be loading fine. It was at the point at which the app was trying to authenticate that it was failing. All working now.

ASP.NET Core 2.1 - Unable to start process dotnet.exe

After upgrading an application from .NET Core 1.0 to 2.1, I am receiving the following error when I try to debug it with IIS Express:
Unable to start process C:\Program Files\dotnet\dotnet.exe. The web server request failed with status code 502, Bad Gateway.
However, this only happens every second time I launch the application. Otherwise it works just fine if I just launch it again.
This creates a mild nuisance to my debugging process, as I constantly have to keep closing the error windows popping up.
The full response shows some additional info:
HTTP Error 502.3 - Bad Gateway
The specified CGI application encountered an error and the server terminated the process.
And the error code "0x80072efe" is shown.
Logging is enabled in web.config, but the crashing launches are not shown at logs at all. I have also tried looking Event Viewer for additional information, but I have not found anything.
The only fix for this I have found so far is to set Kestrel use libuv instead of sockets, but I have no idea why it works. Does anyone have any idea how to fix this?
I encountered the same problem after I upgraded, regardless of what I did it would always show the 502 error on the second load. It appears this problem was introduced in ASP.NET Core 2.1. I tracked it down to the asp-prerender-module tag in my view. Remove the prerender and it goes away.
I was able to fix the problem and keep my prerendering by upgrading to ASP.NET Core 2.2.

How to implement working web server with Mono WebAPI application

Mono 3.2 MVC4 WebAPI application is running in Debian x64 VPS server. Mono is compiled from source and 4.5 subtree is used.
Application requires Chrome or Safari browser.
After refreshing browser window several times server does not work properly. I tried all known free possibilites:
Apache + mod_mono
After pressing browser refresh button several times server randomly returns 500 error for some pages
and apache error log contains "failed to map path" exception.
I posted it in
https://stackoverflow.com/questions/20356779/how-to-fix-failed-to-map-path-errors-in-mono-mvc4-application
and in
Mono ASP.NET mailing list without any response.
There are number of mono applications in server, maybe mod_mono selects wrong thread or is there some bug in webapi mapping implementation in mono.
Nginx + mono-fastcgi-server4.exe
Holding down F5 key causes 200% CPU usage forever in mono-fastcgi-server4.exe
I posted it in
https://stackoverflow.com/questions/20512978/how-to-limit-mono-197-cpu-usage-in-mono-fastcgi-server
and in
Mono ASP.NET mailing list without any solution.
Is looks like there is bug in mono fastcgi server or it is not compatible with mono 3.2
Using xsp4.exe directly
It causes "server does not return data" in Chrome if browser window is refreshed several times.
I posted this in
https://code.google.com/p/chromium/issues/detail?id=329311
without response.
Maybe xsp4 does not implement http protocol properly.
Havent tried ServiceStack since it cannot used for closed source development which is required. Also application uses also images, css, js files and MVC views which needs also served.
How to create proper server for mono which returns correct data ?
When 500 errors happen, somewhere in the mono class libraries an exception was thrown, you can find out more by using tracing:
mono --trace=E:System.Exception YourApp.exe
This way it's very possible that you find out what is causing the load problems you're seeing in each case (to do this for mono-fastcgi, you would need to add the trace argument in the script that calls mono-fastcgi-server4.exe).