public WebApiTest() { IOExtensions.DeleteDirectory("Test"); NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(19079); Task.Factory.StartNew(() => // initialize in MTA thread { config = new HttpSelfHostConfiguration(Url) { MaxReceivedMessageSize = Int64.MaxValue, TransferMode = TransferMode.Streamed }; var configuration = new InMemoryConfiguration(); configuration.Initialize(); configuration.DataDirectory = "~/Test"; ravenFileSystem = new RavenFileSystem(configuration); ravenFileSystem.Start(config); }) .Wait(); server = new HttpSelfHostServer(config); server.OpenAsync().Wait(); WebClient = new WebClient { BaseAddress = Url }; }
protected void StartServerInstance(int port) { NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port); HttpSelfHostConfiguration config = null; Task.Factory.StartNew(() => // initialize in MTA thread { config = new HttpSelfHostConfiguration(ServerAddress(port)) { MaxReceivedMessageSize = Int64.MaxValue, TransferMode = TransferMode.Streamed }; var configuration = new InMemoryConfiguration(); configuration.Initialize(); configuration.DataDirectory = "~/" + port; configuration.Port = port; IOExtensions.DeleteDirectory(configuration.DataDirectory); var ravenFileSystem = new RavenFileSystem(configuration); ravenFileSystem.Start(config); disposables.Add(ravenFileSystem); }) .Wait(); var server = new HttpSelfHostServer(config); server.OpenAsync().Wait(); disposables.Add(server); }