When we create a new web application in SharePoint from Central Admin,we see that a free port is automatically populated. Is there a good way to determine the free ports like SharePoint does?
Tell me more
×
SharePoint Stack Exchange is a question and answer site for
SharePoint enthusiasts. It's 100% free, no registration required.
|
The way SharePoint does it is to generate a random number, which it then tests to see if the port is in use on the local machine. If you have .NET Reflector, check out SPGlobalAdmin.GenerateRandomPort(int initialValue) in Assembly: Microsoft.SharePoint.dll Namespace: Microsoft.SharePoint.Administration |
|||
|