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

swagger.json file loses details over time #193

Open
justynbussey opened this issue Aug 27, 2019 · 1 comment
Open

swagger.json file loses details over time #193

justynbussey opened this issue Aug 27, 2019 · 1 comment

Comments

@justynbussey
Copy link

I have the necessary pages setup using the following route.

RouteTable.Routes.Add(new ServiceRoute("swagger/ui", new WebServiceHostFactory(), typeof(SwaggerWcfEndpoint)));

When I run the site locally in Visual Studio, I can access both the following URLs without any issue.

/swagger/ui (which correctly redirects to /swagger/ui/index.html?url=/swagger/ui/swagger.json)
/swagger/ui/swagger.json

However, when I publish the site to an IIS server, then immediately after the release the above pages work, but then sometime within a span of 12 hours (overnight) the swagger.json file loses all of its details. What I mean loses details is that it starts full of the info, operations, tags, everything as expected:

{"swagger":"2.0","info":{"title":"Test Web Service","description":"Description of the web service"}, ...etc...

Then later on (haven't narrowed down the exact timing other than it happens overnight) the swagger.json file becomes simply:

{"swagger":"2.0"}

I'm at a loss to figure out why, any help would be appreciated.

@justynbussey
Copy link
Author

Discovered my issue is similar (same underlying problem, but different scenario) to issue #126

I have a separate assembly for my host and service, so that my web service code is agnostic of hosting platform. No dynamically loaded assemblies, just separation of concerns using what I believe to be best practices of WCF web service design.

Because IIS is smart enough to only load assemblies it requires on demand, the service assembly is not immediately loaded after a application pool recycle or restart. And since all my attributes are in the service assembly, it's not loaded in AppDomain.CurrentDomain when SwaggerWcf initializes.

My workaround at the moment is to load the assembly of the decorated service class in Application_Start with the following line of code:

AppDomain.CurrentDomain.Load(typeof(RestService).Assembly.FullName);

The above works; however, is there a way to let SwaggerWcf know explicitly which service classes to process during initialization?

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

No branches or pull requests

1 participant