当前位置: 移动技术网 > 网络运营>服务器>Linux > Webservice远程调试及超时操作原理解析

Webservice远程调试及超时操作原理解析

2020年07月30日  | 移动技术网网络运营  | 我要评论

webservice远程调试

在.net 中已经默认将webservice的远程调试功能关闭,有的时候我们需要远程调试程序的时候,就需要打开此功能我们只需在webservice的项目的中添web.config的<system.web>配置节下面加一下一段配置就ok了,代码如下:

 <system.web>
    <compilation debug="true" />
  <webservices>
     <protocols>
      <add name="httpsoap"/>
      <add name="httppost"/>
      <add name="httpget"/>
      <add name="documentation"/>
     </protocols>
   </webservices>
 </system.web>

webservice 超时操作

在执行 webservice 某些方法时会消耗较长的时间,当超出系统默认的时间长度时,系统就会报错。此时可做如下处理:

1、修改 app.config 文件,添加如下代码:

<httpruntime executiontimeout="600" />

请求执行超时时间为600秒(默认为110秒)

2、设置 web services 的 timeout 属性

对 xml web services 的同步调用的超时(以毫秒为单位)。默认为 100000 毫秒。

webservicetest.service1 src = new testwinapp.webservicetest.service1();

src.url = txtaddress.text;

src.timeout = -1;//1120 * 1000;单位为毫秒

指示 xml web services 客户端等待同步 xml web services 请求完成的时间(以毫秒计)。

提示:如果将 timeout 属性设置为 timeout.infinite(=-1),则指示该请求无超时。即使 xml web services 客户端可以将 timeout 属性设置为无超时,web 服务器仍可以在服务器端使请求超时。

系统将以上面两项设置的最小者作为操作超时的时间长度。

iis对web service请求大小与超时的限制

默认请求大小不得超过2m, 重新设置的方法:在web.config中,

<httpruntime executiontimeout="600" maxrqeustlength="32768"/>

同时,iis default web site控制界面可以设置"connection timeout",默认值是120秒。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网