public Task <string> OpenAsync(CancellationToken cancellationToken) { var serviceEndpoint = this.serviceContext.CodePackageActivationContext.GetEndpoint(this.endpointName); var protocol = serviceEndpoint.Protocol; int port = serviceEndpoint.Port; if (this.serviceContext is StatefulServiceContext) { StatefulServiceContext statefulServiceContext = this.serviceContext as StatefulServiceContext; this.listeningAddress = string.Format( CultureInfo.InvariantCulture, "{0}://+:{1}/{2}{3}/{4}/{5}", protocol, port, string.IsNullOrWhiteSpace(this.appRoot) ? string.Empty : this.appRoot.TrimEnd('/') + '/', statefulServiceContext.PartitionId, statefulServiceContext.ReplicaId, Guid.NewGuid()); } else if (this.serviceContext is StatelessServiceContext) { this.listeningAddress = string.Format( CultureInfo.InvariantCulture, "{0}://+:{1}/{2}", protocol, port, string.IsNullOrWhiteSpace(this.appRoot) ? string.Empty : this.appRoot.TrimEnd('/') + '/'); } else { throw new InvalidOperationException(); } this.publishAddress = this.listeningAddress.Replace("+", FabricRuntime.GetNodeContext().IPAddressOrFQDN); try { this.eventSource.Message("Starting web server on " + this.listeningAddress); //this.webApp = WebApp.Start(this.listeningAddress, appBuilder => this.startup.Invoke(appBuilder)); this.webApp = appHost.Init().Start(this.listeningAddress); this.eventSource.Message("Listening on: " + this.publishAddress); return(Task.FromResult(this.publishAddress)); } catch (Exception ex) { this.eventSource.Message("Web server failed to open endpoint {0}. {1}", this.endpointName, ex.ToString()); this.StopWebServer(); throw; } }
public void InitializeContext() { appHost = new AppHostForAzureTesting(); appHost.Init(); appHost.Start(BaseUrl); client = new JsonServiceClient(BaseUrl); subscriptionsStore = appHost.Resolve <ISubscriptionStore>(); eventSink = appHost.Resolve <IEventSink>(); }
public void TestFixtureSetUp() { appHost = new AppSelfHost(); appHost.Init(); appHost.Start(BaseUrl); }
public void SetUp() { testAppHost.Init().Start("http://localhost:22334/"); }