Analysis of Webservice remote debugging and timeout operation principle

  • 2021-08-21 21:54:49
  • OfStack

WebService Remote Debugging

In. NET, the remote debugging function of WEBSERVICE has been turned off by default. Sometimes when we need to debug programs remotely, we need to turn on this function. We only need to add web. config in the project of WEBSERVICE < system.web > The configuration section is OK by adding 1 to the next 1 section, and the code is as follows:


 <system.web>
    <compilation debug="true" />
  <webServices>
     <protocols>
      <add name="HttpSoap"/>
      <add name="HttpPost"/>
      <add name="HttpGet"/>
      <add name="Documentation"/>
     </protocols>
   </webServices>
 </system.web>

WebService timeout operation

It takes a long time to execute some methods of WebService, and when the system default time is exceeded, the system will report an error. You can do the following at this time:

1. Modify the app. config file to add the following code:

<httpRuntime executionTimeout="600" />

Request execution timeout is 600 seconds (default is 110 seconds)

2. Set the Timeout property of Web services

Timeout (in milliseconds) for a synchronous call to XML Web services. The default is 100,000 milliseconds.

WebServiceTest.Service1 src = new TestWinApp.WebServiceTest.Service1();

src.Url = txtAddress.Text;

src. Timeout =-1; //1120* 1000; In milliseconds

Indicates the time (in milliseconds) that the XML Web services client waits for the synchronization XML Web services request to complete.

Tip: If the Timeout property is set to Timeout. Infinite (=-1), it indicates that the request has no timeout. Even though the XML Web services client can set the Timeout property to no timeout, the Web server can time out the request on the server side.

The system will use the minimum of the above two settings as the length of time for the operation timeout.

IIS Restrictions on web service Request Size and Timeout

The default request size must not exceed 2M. Reset: In web. config,

<httpRuntime executionTimeout="600" maxRqeustLength="32768"/>

At the same time, "Connection timeout" can be set in the control interface of IIS Default Web Site, and the default value is 120 seconds.


Related articles: