Your problem is that .asmx files are compiled on first reference after the web app is started. You need either to identify a way to precompile or do a request after start up to get them compiled. Also I'm removing asp.net-core as .asmx is part of the WebForms stack and not part of modern .NET.
I would suggest that you disable the app pool timeout. If no one is using the system, then the app pools will timeout and go to sleep. The restart thus takes time. The setting is under IIS applicaiton pools, and the so called process model timeout. You want to disable this feature. This issue has ZERO to do with recompiling. As I assume that if this was a ONE TIME issue, then it would only occur once after a re-deployment, and the issue looks to be not the VERY first time such a web method end point is used, but the first time even if the site been running for weeks.
asmx files are not necessary compiled on first use, and the publishing wizard has had the option to publish as pre-compiled for more then 15 years now. So, sure, try checking the precompile box before a deploy, but I highly doubt this delay issue has anything to do with compiling unless this occurs only EVER one time after a deployment, not that the site been idle say for a few hours. So, SUPER important that you the poster here make this issue clear: is delay only ever one time, or does it occur again after some time of not using the site? So deploy as pre-compiled and see if issue goes away
.asmx
files are compiled on first reference after the web app is started. You need either to identify a way to precompile or do a request after start up to get them compiled. Also I'm removing asp.net-core as.asmx
is part of the WebForms stack and not part of modern .NET.XmlSerializer
assemblies with<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
. See When to change the Generate Serialization Assembly value?. XmlSerializer - the first deserialization is very slow and What is MyAssembly.XmlSerializers.dll generated for?.