visual studio code - What version of Nancy package can we use for asp.net core 2.0? -


not sure put question i'm interested in nancyfx asp.net core 2.0 have tried use both 2.0.0-pre1878 version , 2.0.0-clinteastwood without luck. has managed use these? there reference application me play with?

try:

<itemgroup>    <packagereference include="microsoft.aspnetcore" version="2.0.0" />    <packagereference include="microsoft.aspnetcore.hosting" version="2.0.0" />    <packagereference include="microsoft.aspnetcore.owin" version="2.0.0" />    <packagereference include="nancy" version="2.0.0-clinteastwood" />  </itemgroup> 

(specifically notice need microsoft.aspnetcore.owin)

is there reference application me play with?

yes.

https://github.com/nancyfx/nancy/tree/master/samples/nancy.demo.hosting.kestrel

minimal example:

using system.io; using microsoft.aspnetcore.builder; using microsoft.aspnetcore.hosting; using microsoft.extensions.configuration; using nancy; using nancy.owin;  namespace hellonancy {   class program   {     static void main(string[] args)     {       var host = new webhostbuilder()         .usecontentroot(directory.getcurrentdirectory())         .usekestrel()         .usestartup<startup>()         .build();        host.run();     }   }    public class startup   {     private readonly iconfiguration config;      public startup(ihostingenvironment env)     {       var builder = new configurationbuilder().setbasepath(env.contentrootpath);       config = builder.build();     }      public void configure(iapplicationbuilder app)     {       app.useowin(x => x.usenancy(opt => opt.bootstrapper = new demobootstrapper()));     }   }    public class demobootstrapper : defaultnancybootstrapper   {     public demobootstrapper()     {     }   }    public class samplemodule : nancy.nancymodule   {     public samplemodule()     {       get("/", _ => "hello world!");     }   } } 

(specifically notice should use kestrel core, not self hosting, nancy.hosting.self targets 4.6, not netstandard)


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -