Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the tutorial for using OWIN middleware #337

Closed
cosmin-ciuc opened this issue Oct 5, 2016 · 6 comments
Closed

Update the tutorial for using OWIN middleware #337

cosmin-ciuc opened this issue Oct 5, 2016 · 6 comments

Comments

@cosmin-ciuc
Copy link

Would it be possible to change the tutorial for usage of OWIN middleware so that instead of recommending to route all the requests through ASP.NET pipeline

<system.webServer>
        ...
        <modules runAllManagedModulesForAllRequests="true">
            ...

it would recommend to add the following three lines in web.config file:

<system.webServer>
     ...
    <handlers>
       ...
      <add name="SwaggerIndex" path="swagger/index.html" verb="*" type="NSwag.AspNet.Owin.SwaggerUiIndexMiddleware" />
      <add name="SwaggerGenerator" path="swagger/v1/swagger.json" verb="*" type="NSwag.AspNet.Owin.SwaggerMiddleware" />
      <add name="SwaggerRedirect" path="swagger" verb="*" type="NSwag.AspNet.Owin.RedirectMiddleware" />

?

@cosmin-ciuc cosmin-ciuc changed the title Update to ysage of OWIN middleware tutorial Update to usage of OWIN middleware tutorial Oct 5, 2016
@cosmin-ciuc cosmin-ciuc changed the title Update to usage of OWIN middleware tutorial Update the tutorial for using OWIN middleware Oct 5, 2016
@RicoSuter
Copy link
Owner

I agree with you that piping all request through .NET may be problematic...

@cosmin-ciuc
Copy link
Author

I have tested the settings I've wrote above and they work. Of course, you have to register SwaggerUI on "/swagger" address like this:

                RouteTable.Routes.MapOwinPath(
                    "swagger",
                    app =>
                        {
                            app.UseSwaggerUi(
                                typeof(Global).Assembly,
                                new SwaggerUiOwinSettings
                                    {
                                        MiddlewareBasePath = "/swagger"

@RicoSuter
Copy link
Owner

Ok? https://github.com/NSwag/NSwag/wiki/OwinGlobalAsax

@cosmin-ciuc
Copy link
Author

Perfect. Thank you.

@RicoSuter
Copy link
Owner

Thank you for helping here. Btw: You can also create a PR to change the wiki with your suggestions :-)...

@chucklu
Copy link
Contributor

chucklu commented Jan 25, 2019

Hi @RSuter, @cosmin-ciuc ,
I can only work with the first configuration in modules level, when I try to use the second. Configured it in handler, it did not work.
Could you provided a sample for the second configuration?
By the way, I am working this tutorial : https://github.com/RSuter/NSwag/wiki/OWIN-Middleware

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants