Env:

Client: WinForm(Net Framework 2.0)

Server:Web Service(Net Framework 4.0)

Problem:

Client use proxy to invoke a simple method in web services, this method only take a few milliseconds but the first invoke may take more than 10 seconds.

Reason:

The defult proxy was enable by default (if the element is not specified)in configure, so  client will wait the default proxy timeout then use the proxy we defined at the first time.

Resolve:

Add the following code in configure:

<system.net>
<defaultProxy enabled="false" useDefaultCredentials="false">
<proxy/>
<bypasslist/>
<module/>
</defaultProxy>
</system.net>

or Add the following code in application:

HttpWebRequest.DefaultWebProxy = null;

//=========================

WebClient wc = new WebClient();
wc.Proxy = null;

Learn from the following site:

http://blog.csdn.net/rrrfff/article/details/6170653

http://msdn2.microsoft.com/en-us/library/kd3cf2ex(VS.80).aspx

第一次调用Web service响应速度慢的解决办法的更多相关文章

  1. ORACLE存储过程调用Web Service

    1. 概述 最近在ESB项目中,客户在各个系统之间的服务调用大多都是在oracle存储过程中进行的,本文就oracle存储过程调用web service来进行说明.其他主流数据库,比如mysql和sq ...

  2. delphi调用web service出现 Unable to retrieve the URL endpoint for Service/Port .....

    delphi调用web service出现 Unable to retrieve the URL endpoint  for Service/Port, 错误截图如下 查了很长时间, 发现在DataM ...

  3. C#之VS2010ASP.NET页面调用Web Service和winform程序调用Web Service

    一:用ASP.NET调用Web Service 打开VS2010,打开“文件-新建-网站”,选择“ASP.NET网站” 选好存储位置,语言后点击确定,进入默认页面.然后先添加Web引用,把WebSer ...

  4. 基于Web Service的客户端框架搭建一:C#使用Http Post方式传递Json数据字符串调用Web Service

    引言 前段时间一直在做一个ERP系统,随着系统功能的完善,客户端(CS模式)变得越来越臃肿.现在想将业务逻辑层以下部分和界面层分离,使用Web Service来做.由于C#中通过直接添加引用的方来调用 ...

  5. [Teamcenter 2007 开发实战] 调用web service

    前言 在TC的服务端开发中, 能够使用gsoap 来调用web service. 怎样使用 gsoap  , 參考 gsoap 实现 C/C++ 调用web service 接下来介绍怎样在TC中进行 ...

  6. ASP.NET4.0中JavaScript脚本调用Web Service 方法

    环境:VS2019  .net 4.0 framework 根据教材使用ScriptManager在JavaScript中调用Web service 时,失败.现将过程和解决方法记录如下: 1.定义W ...

  7. C#开发和调用Web Service

    http://blog.csdn.net/h0322/article/details/4776819 1.1.Web Service基本概念 Web Service也叫XML Web Service ...

  8. php5调用web service

    工作中需要用php调用web service接口,对php不熟,上网搜搜,发现关于用php调用web service的文章也不多,不少还是php4里用nusoap这个模块调用的方法,其实php5里已经 ...

  9. 通过ksoap2-android来调用Web Service操作的实例

    import java.io.IOException; import org.ksoap2.SoapEnvelope;import org.ksoap2.serialization.SoapObjec ...

随机推荐

  1. request.setAttribute("username", username);//一定要保存,OGNL才能获取${username}

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, ...

  2. Qt中内存泄露和退出崩溃的问题

    http://blog.csdn.net/wangkuiyun/article/details/7412379

  3. Leetcode 1018. Binary Prefix Divisible By 5

    class Solution: def prefixesDivBy5(self, A: List[int]) -> List[bool]: ans,t = [],0 for a in A: t ...

  4. 常用的两个PHP类

      /** * Class Interval * @author logonmy * @desc 简单分析程序执行时间: */   Class Interval{ var $start;   publ ...

  5. HDU - 6166:Senior Pan(顶点集合最短路&二进制分组)

    Senior Pan fails in his discrete math exam again. So he asks Master ZKC to give him graph theory pro ...

  6. js删除局部变量的实现方法

    lert('value:'+str+'\ttype:'+typeof(str)) //声明变量前,引用 var str="dd"; alert('value:'+str+'\tty ...

  7. matlab_移动文件和复制文件

    clear clc cd('C:\Users\xx\Desktop\learning'); % 设置当前目录 % 此时learning文件夹中有:文件夹x, 文件夹y, 文件a.png, 文件b.pn ...

  8. 使用DeflateStream压缩与解压

    具体可以了解下:http://msdn.microsoft.com/zh-cn/library/system.io.compression.deflatestream(v=vs.110).aspx / ...

  9. Indy发送邮件被kbas退掉

    用indy开发了发送邮件程序,通过126,sina等发送邮件可以发送出去,而通过tom,163则被退回,显示被 kbas系统退回.后来通过观察Foxmail的通讯过程,区别在foxmail发送EHLO ...

  10. 【转】使用Jmeter录制web脚本

    1.web性能测试以及web http请求基本原理. 再介绍录制jmeter脚本之前,我们先谈一下web性能测试.web就是调用http/https接口, 其实没有是什么复杂度可言.只是我们必须清楚, ...