Owin: how to pass arguments to my own startup class? -
I am trying to develop a web API self-hosting app using OVIN in my XyzStartup class, Argument is required: contentFolderPath.
However, I could not find any way to pass this argument. Here's my code:
var contentFolderPath = this.TextBox.Text; // user input var startOptions = new initial option (); (Style Content FolderPath) {... (Start Control FolderPath) {... (Start Controller Folder)}} I saw a startup class, but how to use it. I can already use it in my XyzStartup class
thanks
I finally find a way to do this ?!
on StartOptions = new initial option (); StartOptions.Urls.Add ('.. some url ..'); WebApp.Start (startOptions, (appBuilder) = & gt; {New XyzStartup (contentFolderPath) .Configuration (appBuilder);}
If you want to pass the parameter to the startup category, you can use the action in the WebApp.Start in CilliĆ © Malan's As a result, your mention in the comment, rather than starting with the type parameter ( WebApp.Start & lt; t & gt; ) Here is a solid example for self hosted: < / P>
object on someThingYouWantToAccess; Server = WebApp. (" Http: // localhost: 8080 / "start, (appbuilder) => gtc: // // you can manually configure someThingYouWantToAccess // here for the host. Http configconf = config = new.httpConfiguration (); config.MapHttpAttributeRoutes () ;; Config.routes.MapHttpRoute (name: "DefaultApi", routeTemplate: "API / {controller} / {ID}", default: new {id = RouteParameter.Optional}); appBuilder.UseWebApi (config);});
Comments
Post a Comment