/// <summary> /// Initializes an OWIN host with a random port. /// </summary> /// <remarks> /// Tries 10 times to listen on random port in the range 48620-49150 /// (see <a href="http://stackoverflow.com/questions/2200199/how-do-you-decide-what-port-to-use">How do you decide what port to use</a> /// discussion in Stack Overflow. /// </remarks> /// <param name="removeOwinTraceListeners">Whether to remove the trace listeners added by OWIN.</param> /// <returns>A dispose to close the OWIN host.</returns> /// <exception cref="OwinFailedToStartException">Starting OWIN failed every time.</exception> public static IDisposable InitializeOwinWithRandomPort(bool removeOwinTraceListeners) { return(OwinInitializer.InitializeOwinWithRandomPort(removeOwinTraceListeners, 10)); }
/// <summary> /// Initializes an OWIN host with a random port. /// </summary> /// <remarks> /// Tries to listen on random port in the range 48620-49150 /// (see <a href="http://stackoverflow.com/questions/2200199/how-do-you-decide-what-port-to-use">How do you decide what port to use</a> /// discussion in Stack Overflow. /// </remarks> /// <param name="removeOwinTraceListeners">Whether to remove the trace listeners added by OWIN.</param> /// <param name="maxAttempts">The maximum number of attempts to listen on random port.</param> /// <returns>A dispose to close the OWIN host.</returns> /// <exception cref="OwinFailedToStartException">Starting OWIN failed every time.</exception> public static IDisposable InitializeOwinWithRandomPort(bool removeOwinTraceListeners, int maxAttempts) { return(OwinInitializer.InitializeOwinWithRandomPort(removeOwinTraceListeners, 48620, 49150, maxAttempts)); }