i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Add support for OWIN and self hosted/non IIS hosted apps

Open jonnybee opened this issue 10 years ago • 6 comments

Hope I18N project will support OWIN pipeline without dependencies on the "old" IIS hosting/pipeline.

This would also add support for self hosted apps.

jonnybee avatar Sep 15 '14 06:09 jonnybee

I have an owin middleware that will work in IIS (httpcontextbase dependencies). To make this work in self hosted app i18n will need to be rewritten to not depend on the IIS pipeline classes.

I also had to fix the Flush method of the ResponseFilter class because in owin it's called twice which caused a nullreferenceexception on the bufferedstream being null

added a pull request #234

suddenelfilio avatar Dec 02 '15 10:12 suddenelfilio

@suddenelfilio I'm using owin/WebApi2 with IIS, can you please enlighten me what changes I need to make to make i18n work? Thx.

berniezhao avatar Jan 04 '16 20:01 berniezhao

I've not managed to look into OWIN support yet so hopefully others will chip in here, but my understanding from what's already been stated above is that OWIN doesn't support the ASP.NET pipeline upon which the i18n.LocalizingModule class depends.

The pipeline events we currently handle are BeginRequest, ReleaseRequestState and PostRequestHandlerExecute. Should there be a way of hooking into equivalent stages in OWIN's HTTP request handler then a modified version of i18n.LocalizingModule would need to integrate with that.

turquoiseowl avatar Jan 04 '16 20:01 turquoiseowl

There are some structure challenges. OWIN uses middleware which uses .NET 4.5. It also uses Microsoft.Owin instead of System.Web. Therefore it seems like we need to move Pipeline folder out of i18n project, and make two dedicated i18n.IIS and i18n.Owin projects that implements pipeline separately, but still able to use the i18n classes like NuggetLocalizer.

Or maybe it makes more sense to make 3 NuGet packges. i18n.core, i18n.AspNet and i18n.Owin. :)

berniezhao avatar Jan 04 '16 21:01 berniezhao

Yes, in addition to i18n.LocalizingModule, HttpContextBase would be an issue. I'm unclear on what the current state of affairs is with that class, in relation to ASP.NET old and new, WebApi, OWIN etc.......

turquoiseowl avatar Jan 04 '16 22:01 turquoiseowl

@turquoiseowl I created a pull request to add support for Owin hosted in IIS. For self-hosted Owin we will need major structure changes. Let me know how do you want to handle the pull request. It doesn't break existing i18n assembly so either you can include it in your NuGet or if you want me to publish a separate NuGet that's ok too. Thanks.

berniezhao avatar Jan 05 '16 17:01 berniezhao