public void Configuration(IAppBuilder spAppBuilder) { if (options == null) { options = new SgxOptions.SgxOptions(Properties.Settings.Default.Properties, log); } log.Debug("Configuration(.) started."); try { HttpConfiguration spconfig = new HttpConfiguration(); spconfig.Routes.MapHttpRoute( name: Constants.DefaultApi, routeTemplate: Constants.RouteTemplate, defaults: new { id = RouteParameter.Optional }); spAppBuilder.UseWebApi(spconfig); LoadEnclaveSettings(); iasConnectionMgr = new SpIasConnectionManager(); } catch (Exception e) { options.LogThrownException(e); log.Debug("Failed to set up HTTP, proxy, or IAS connection - check settings"); throw e; } finally { log.Debug("Configuration(.) returning."); } }
static void Main(string[] args) { var options = new SgxOptions.SgxOptions(Properties.Settings.Default.Properties, log, args); try { options.ParseOptions(); options.PrintBanner(); log.Debug("application starting"); // Check if an error occurred while parsing command line options and only // run the server if we didn't have any. if (!options.invalidOption) { string urlString = Properties.Settings.Default.SPUri; // Using the route map defined with the OWIN interface via: // Configuration(IAppBuilder ?AppBuilder) in the startup file, // start the server with defalut settings for now. using (WebApp.Start <SpStartup>(url: urlString)) { Console.WriteLine("Server Started for: {0}", urlString); Console.WriteLine(); Console.ReadLine(); } } } catch (System.Reflection.TargetInvocationException e) { Exception ie; options.LogCaughtErrorException(e); Console.WriteLine("RA Server failed to establish connection."); Console.WriteLine("Is there an instance of this server already running?"); Console.WriteLine("Exception Details:"); for (ie = e; ie != null; ie = ie.InnerException) { Console.WriteLine(" {0}", ie.Message); } } finally { log.Info("application ending"); } }