网络服务初始化问题 [英] Webservice initialisation issue

查看:27
本文介绍了网络服务初始化问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的网络服务.当我第一次调用我的测试方法时,它需要大约 5 秒的响应时间,此后它花费的时间非常少,这很好.

I have a simple web service. When I call my test method for the first time it takes about 5 seconds to respond and thereafter it takes very less time which is fine.

但是如果我的应用程序保持空闲 5 分钟,当我再次调用相同的方法时,它需要花费相同的时间才能响应.我怎样才能让它更快?

But if my application stays idel for 5 mins and when i call the same method again it takes same amount of time took before to respond. How can I make it faster ?

我尝试通过设置 keepalive = true 并预编译和部署,仍然没有运气

I tried by setting the keepalive = true and pre compiling and deploying, still no luck

localhost.WebService1 svc = new WebSvcTest.localhost.WebService1();

        private void button1_Click(object sender, EventArgs e) {

            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();

            string returnVal = svc.HelloWorld();

            stopWatch.Stop();

            TimeSpan ts = stopWatch.Elapsed;

            // Format and display the TimeSpan value.
            string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                ts.Hours, ts.Minutes, ts.Seconds,
                ts.Milliseconds / 10);

            MessageBox.Show(elapsedTime);
        }

推荐答案

问题是 IIS ProcessModel IdleTimeout 设置为 20 分钟.我将其设置为 0,现在一切正常.非常感谢

problem was IIS ProcessModel IdleTimeout was set to 20 mins. I set it to 0, now everything works fine. thanks a lot

这篇关于网络服务初始化问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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