Webservice initialisation issue

时光总嘲笑我的痴心妄想 提交于 2020-01-06 07:06:31

问题


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.

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 ?

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);
        }

回答1:


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



来源:https://stackoverflow.com/questions/4323211/webservice-initialisation-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!