0

I have a program that uses web reference in order to connect to the server. The web reference is configured in app.config file in the following way:

   <applicationSettings>
        <blala.Properties.Settings>
          <setting name="blablaClient_AppexScan_Service1" serializeAs="String">
            <value>http://www.apex.com/CxWS/Service1.asmx</value>
          </setting>
        </blabla.Properties.Settings>
  <applicationSettings>

I would like to add to the setting a property of Timeout. I would like to change the default timeout from 100000 msec to something else and I would like to do it in the app.config.

when I tried to add:

<setting name="Timeout" serializeAs="String">

       <value>30</value>

</setting>

it didn't change the default timeout. How can I do it?

mary
  • 869
  • 5
  • 13
  • 26

2 Answers2

1

Adjust the proxy of your web service

var timeout = System.Configuration.ConfigurationSettings.AppSettings["Timeout"];

WebReference.ProxyClass myProxy = new WebReference.ProxyClass();
myProxy.Timeout = timeout; 
Aghilas Yakoub
  • 28,516
  • 5
  • 46
  • 51
0

Try to set the timeout after initialising your web services.

WSName.WSClass refWS = WSMng.Initialize(ServerName, ServerPort, ServerInstance, ServerCompanyName);
refWS.Timeout = 200000;
CSchulz
  • 10,882
  • 11
  • 60
  • 114
jin
  • 1
  • 1