public void SetApp(AppFunc appFunc) { switch (_state) { case OwinHostState.ConfigureHost: throw new Exception("The Server must be specified before setting the AppFunc."); case OwinHostState.ConfigureApp: _server.SetAppFunc(appFunc); _state = OwinHostState.Runnable; return; case OwinHostState.Runnable: throw new Exception("The AppFunc may only be set once."); default: throw new ArgumentOutOfRangeException("Unknown Host State: " + _state); } }
public void SetServer(IOwinServer server) { switch (_state) { case OwinHostState.ConfigureHost: _server = server; _server.Configure(new OwinHostContext(_hostContext.Environment)); _state = OwinHostState.ConfigureApp; return; case OwinHostState.ConfigureApp: case OwinHostState.Runnable: throw new Exception("The Server may only be set once."); default: throw new ArgumentOutOfRangeException("Unknown Host State: " + _state); } }
public OwinHost() { _hostContext = new OwinHostContext(OwinFactory.CreateEnvironment()); _state = OwinHostState.ConfigureHost; }