How do you specify the patch version a .NET Core 3.1 app should target (500.31 ANCM error in localhost AND IIS)? - asp.net-core-3.1

I have a .NET Core 3.1 application that has a target framework of 'netcoreapp3.1'. When I try to debug this application or run it from IIS I get a 'HTTP Error 500.31 - Failed to load ASP.NET Core runtime' message. The body then goes on to say that I must install .NET Core 3.1.27, which is the latest patch version. I have done this on IIS and the site is working but why is this the case that the app must run on the latest patch version? I have never gotten this error before and I certainly haven't kept up with every single patch version. I have not downloaded the latest patch on my local machine and still cannot debug the app. Is there a way to tell it to run on the most recent patch available? For example, I do have patch 3.1.25, so why can't it run on that?
Thanks.

Related

Upgrade .NET Framework 4.5 to 4.8 - Web Application Returning 404 Error

I have attempting to upgrade a web application that uses .NET Framework 4.5 to 4.8.
The application runs on a server that both compiles and runs the application, so I installed the .NET Framework 4.8 Developer Pack. I restarted the server and it has booted up successfully.
TeamCity successfully built and compiled the application and Octopus successfully deployed as per usual. However, when I now attempt to access the website, I get a 404 at the login page.
Looking at the folder structure, the file is definitely there. The code builds and runs successfully on my local machine, allowing me to login and perform any function on the system.
Is there something that I have missed running or doing on the server to get this to work?
Edit: Request for IIS Configuration
The configuration of this hasn't changed since I've upgrade the .NET Framework but here is what I have. If this isn't the configuration that is being asked about, please let me know.
Bindings
Everything else has been left as the default values.

DLL creating a connection fails with "An existing connection was forcibly closed by the remote host"

I have created a DLL [made available as a NuGet package (.NetStandard 2.0/2.1)].
When a particular class in this DLL is instantiated, we fire an synchronous GET call to a .Net Core WebAPI installed on IIS on my local machine (localhost) to load some configuration data.
This DLL makes use of a singleton HttpClient (we've following Microsoft's 'best practices' here)
Factory.SingletonHttpClient().GetAsync(args.Uri).GetAwaiter().GetResult();
I've consumed this NuGet package in a whole series of applications, all built using .Net Framework 4.7.2 and they work just fine - the data is successfully retrieved from the WebAPI.
However....I have one particular application (again, 4.7.2) where the GET consistently fails with the error message:
System.Net.Sockets.SocketException HResult=0x80004005 Message=An
existing connection was forcibly closed by the remote host
This exception was originally thrown at this call stack:
System.Net.Sockets.Socket.BeginReceive(byte[], int, int, System.Net.Sockets.SocketFlags, System.AsyncCallback, object)
So this has to be something specific to my application that consumes this NuGet package since it works for all other consuming applications. However, I can't see how to figure out what the problem might be.
So I found the answer, but I'm confused by it.
I'm using the latest version of Windows 10 (version 1909).
All my applications are using .Net 4.7.2
So when I debug all these .NET 4.7.2 applications on my machine, they all make the call to the WebAPI on my IIS LocalHost, except this one application.
When I look at the ServicePointManager.SecurityProtocol in this failing application, I see it's running with the obsolete values of SSL and TLS. Why would this be the case for this application but not the others? It's not stipulated anywhere to use these obsolete protocols, so why is this using them but not the other applications?
I fixed this by amending my NuGet DLL to add TLS1.2 to whatever TLS versions are being used:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | ServicePointManager.SecurityProtocol;

.NET Framework Method Not Found 'Void System.GC.Collect'

I'm trying to run some service and I'm getting this message
Method not found: 'Void System.GC.Collect(Int32,
System.GCCollectionMode)'
I suspect the server because this service runs on other servers.
I really want to know what the source of this problem because I came across this problem on other servers.
I try to take of code from my service and finally I realized that even I run a console application with only one static main and call the GC I get this error,
I'm using Windows Server 2003 with Framework 2.0 and 3.5
When you create your console application make sure your target framework is not set to Client Profile FrameWork 3.5.
The above setting is in Application tab of your project properties
If you want to use GCCollectionMode and Framework 2.0 you will have to install .NET 2.0 Service Pack 1

WebSitePanel settings causing crash?

Using Websitepanel ver1.1 on my hosting provider and trying to adjust a website (ASP.NET MVC2) to run under .NET 4 integrated pipeline mode.
Every time i apply this setting i get the following error (to be correct: it doesn't matter if i choose 4.0 or 4.0 integrated pipeline):
System.Web.Services.Protocols.SoapException:
Server was unable to process request.
---> Error executing 'UPDATE' task on 'my_website.com' WEB_SITE
---> Server was unable to process request.
---> Object reference not set to an instance of an object.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at WebsitePanel.EnterpriseServer.esWebServers.UpdateWebSite(WebSite site)
at WebsitePanel.Portal.WebSitesEditSite.SaveWebSite()
Is there something I can do about this? Is there something I'm doing wrong? Setting back to .NET 2.0 or 2.0 pipeline works like a charm!
If you are having a VPS, log into the server Try changing the application pool to 4.0 classic instead of 4.0 integrated from IIS manager >> sites >> basic settings. Also make sure that MVC2 is compatible with asp.net 4.
You can edit the corresponding web.config page to change the asp version by changing the corresponding version line to 4 instead of 2.
Please let us know by changing the application pool to 4.0 classic. If you are not having administrator password, Ask your hosting provider support to do this.
Also ask them to check the event viewer logs to know further about the issue.
The main problem is Websitepanel version 1.1
To solve this error, you need to request your hosting provider to upgrade the websitepanel version to 2.0
.NET 4.0 provides better support for aplications, also .NET 2.0 has been deprecated by several web hosting providers.

ASP.NET Ajax client framework failed to load

We developed an web application using visual studio 2008. In my development PC, the application is working fine. In production server I am getting the following exception "ASP.NET AJAX CLIENT FRAMEWORK FAILED TO LOAD". What should I do to make it work?
Thanks,
P.Gopalakrishnan.
I'd start with making sure all of the appropriate service packs are applied and that the 3.5 framework is actually installed on the box.
Also, make sure any assembly you reference that isn't part of your deployment is gac'd on the machine. Check version numbers.
All else being equal, I'd guess the server is just way out of date on it's updates.