简体   繁体   中英

Using a scheduled powershell task to run remote script timeouts

I need to access an import script located at " http://site.com/script.aspx ", and I have currently setup up a powershell script doing this, the problem is the script probably takes 10minuttes to finish, and this causes the GetResponse to tiemout with : "GetResponse" with "0" argument(s): "The operation has timed out"

$global:url= "http://site.com/script.aspx"
#$myHttpWebRequest = [system.net.WebRequest]::Create($url)
#$myHttpWebRequest.Timeout = 600000 # dosent seem to do whats needed
#$myHttpWebResponse = $myHttpWebRequest.GetResponse()

How do I solve this problem?

If I am reading this right, the PowerShell script is making a request to script.aspx that runs for 10 minutes at which point the web request throws an exception stating that the request has reached the timeout limit and has been terminated?

If so, this is not something that PowerShell has any control over. That is controlled (probably) by a setting on the server at site.com . I would start by looking at the web.config file for that script.aspx page.

<configuration>
  <system.web>
    <!-- increase timeout to 15 minutes -->
    <httpRuntime executionTimeout="900" />
  </system.web>
</configuration>

Reference: http://msdn.microsoft.com/en-us/library/e1f13641%28v=vs.100%29.aspx

我放弃使用Powershell,而是从批处理文件运行wget。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM