Open pysco68 opened 9 years ago
Hi,
This is actually not really part of official Owin standart, so it would be nice is you would add it if you need it :-) I think all changes should be limited to https://github.com/Bobris/Nowin/blob/master/Nowin/OwinServerFactory.cs and https://github.com/Bobris/Nowin/blob/master/Nowin/OwinKeys.cs
I'd really like to give this a try (or even better implement server.OnDispose as they are mentioned in the official specification: https://github.com/owin/owin/blob/master/CommonKeys.md). I've looked at the code for some while now, and I struggle a bit to find the right place(s) to put that in.
My question: In my understanding the CancellationToken should be reachable via both IAppBuilder.Properties and the request environment. Is this a correct interpretation of the specification?
It could be in that capabilities
dictionary. You get them in each request, but I don't think it should be usefull there for anything (https://github.com/Bobris/Nowin/blob/master/Nowin/OwinEnvironment.Generated.tt#L29), you already have owin.CallCanceled
And how to find out that server is disposing just subscribe in https://github.com/Bobris/Nowin/blob/master/Nowin/OwinServerFactory.cs#L79
server.OnInit and server.OnDispose have been standardized. The microsoft key is mentioned as a backward compatibility thing. See https://github.com/owin/owin/issues/27
@serialseb Problem is that Nowin is just server not host or builder, so I am no sure to which Dictionary I should place this (in per request it would be for sure useless. If you know about some sample implementation I could learn from how to do it, I am also interested.
startup properties exist during wireup (if you support BuildFunc), and contain all the common keys "available at startup", as per CommonKeys. The env contains startup keys and the http request associated keys.
In other words, anything that ought to be exposed as a startup key ought to be in its own dictionary, and any key per request / response ought to be in the env dictionary, which contains all the startup keys.
The upcoming 1.0.1 spec will clarify those things.
Hello,
I'm currently trying to migrate an existing OWIN application to be hosted with Nowin. It worked mostly flawlessly (and with good performance results). However on of the last missing pieces is that Nowin seemingly doesn't provide a
CancellationToken
under the keyhost.OnAppDisposing
in the application dictionary.This cancellation token can be used to hook into the disposal process of the application, which can be very useful to dispose things like singletons that were instantiated during the web-application's setup, whitout having to build-up too much messy code.
If you could pinpoint where I should look at to implement the missing parts I'd be happy to contribute to this great project!
Here's some information about the topic: