WCF 服务 - 启动需要额外的时间 [英] WCF Service - Startup takes extra time

查看:33
本文介绍了WCF 服务 - 启动需要额外的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 WCF 服务需要 8-10 秒才能加载第一个命中.之后,只需不到一秒钟的时间.

I find that WCF service will take 8-10 seconds to load the first hit. After that it will take less than a second.

有什么想法吗?

推荐答案

可能是由于 .NET 的冷启动.您是否考虑过设置 IIS 预热模块,该模块在初始请求之前初始化依赖项?

Probably due to .NET's cold start. Have you looked at setting up the IIS Warmup Module which initializes dependancies before an initial request?

来自 学习 IIS 网站

  1. 通过预加载工作进程减少第一次请求的响应时间.IIS 应用程序预热模块允许您将 Web 应用程序配置为在第一个请求到达之前预加载,以便工作进程更快地响应第一个 Web 请求.

  1. Decrease the response time for first requests by pre-loading worker processes. The IIS Application Warm-Up module lets you configure the Web application to be pre-loaded before the first request arrives so that the worker process responds to the first Web request more quickly.

在发生重叠回收时通过预加载工作进程来提高可靠性.由于在重叠回收方案中回收的工作进程仅在完成配置指定的资源加载和初始化后才传达其准备情况并开始接受请求,因此预加载依赖项可减少第一次请求的响应时间.

Increase reliability by pre-loading worker processes when overlapped recycling occurs. Because the recycled worker process in an overlapped recycling scenario only communicates its readiness and starts accepting requests after it finishes loading and initializing the resources as specified by the configuration, pre-loading the dependencies reduces the response times for the first requests.

自定义应用程序的预加载.您可以配置 IIS 应用程序预热模块以使用特定的网页和用户身份来初始化 Web 应用程序.这使得可以根据初始化逻辑创建可以同步或异步执行的特定初始化过程.此外,这些过程可以使用特定的身份来确保正确的初始化.

Customize the pre-loading of applications. You can configure the IIS Application Warm-Up module to initialize Web applications by using specific Web pages and user identities. This makes it possible to create specific initialization processes that can be executed synchronously or asynchronously, depending on the initialization logic. In addition, these procedures can use specific identities to ensure a proper initialization.

这篇关于WCF 服务 - 启动需要额外的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆