I use powershell to update a service with content from a file (csv) using SOAP via new-webserviceproxy. Often the content can have thousands of rows and references different calls to the SOAP service. As such the NWSP is called from within a For Loop. This has not been a problem in the past but recently has started causing ephemeral port exhaustion and the update service slows to a crawl. Once the NWSP updates the service the TCP port stays open in ‘Time_Wait’ until it timesout.
- Is there a way/command to close the NWSP or TCP port at the end of each loop in order to protect the server from port exhaustion?
- OR- Is there a way I can initiate the NWSP outside the loop and somehow reference the proxy from within the loop?