asp.net web api - Web API Help Pages and API Explorer returning 0 descriptions -


i have project web api project. @ point in past removed helppages , made app use owin. have been asked add api helppages in have done. have set startup class bit this:

public void configuration(iappbuilder app) {      // needs first     app.usecors(microsoft.owin.cors.corsoptions.allowall);      // more information on how configure application, visit http://go.microsoft.com/fwlink/?linkid=316888     var httpconfig = new httpconfiguration();      // register areas     arearegistration.registerallareas();      configureoauthtokengeneration(app);     configureoauthtokenconsumption(app);     configurewebapi(httpconfig);     app.usewebapi(httpconfig); } 

so route pages working. far can tell, should work problem apiexplorer doesn't pull descriptions.

in configurewebapi method remove formatting, have commented out , still doesn't work, here method:

private void configurewebapi(httpconfiguration config) {      // web api configuration , services     var formatters = config.formatters;     var jsonformatter = formatters.jsonformatter;     var serializersettings = jsonformatter.serializersettings;      // remove xml formatting     formatters.remove(config.formatters.xmlformatter);     jsonformatter.supportedmediatypes.add(new mediatypeheadervalue("application/json"));     jsonformatter.serializersettings.datetimezonehandling = newtonsoft.json.datetimezonehandling.local;      // configure our json output     serializersettings.contractresolver = new camelcasepropertynamescontractresolver();     serializersettings.formatting = formatting.indented;     serializersettings.referenceloophandling = newtonsoft.json.referenceloophandling.ignore;     serializersettings.preservereferenceshandling = newtonsoft.json.preservereferenceshandling.none;      // web api routes     config.maphttpattributeroutes();      config.routes.maphttproute(         name: "defaultapi",         routetemplate: "api/{controller}/{id}",         defaults: new { id = routeparameter.optional }     ); } 

i edited helpcontroller , put breakpoint on return view line how know apiexplorer has no descriptions:

public actionresult index() {     var docprodivder = configuration.services.getdocumentationprovider();     var desciptions = configuration.services.getapiexplorer().apidescriptions;      viewbag.documentationprovider = docprodivder;     return view(desciptions); } 

i read somewhere if this:

public void configuration(iappbuilder app) {      // needs first     app.usecors(microsoft.owin.cors.corsoptions.allowall);      // more information on how configure application, visit http://go.microsoft.com/fwlink/?linkid=316888     var httpconfig = new httpconfiguration();      var exploerer = new apiexplorer(httpconfig);     var descriptions = exploerer.apidescriptions;      // register areas     arearegistration.registerallareas();      configureoauthtokengeneration(app);     configureoauthtokenconsumption(app);     configurewebapi(httpconfig);     app.usewebapi(httpconfig); } 

i should see descriptions, still doesn't work. read somewhere else set project output xml description file , configure helppageconfig file use documentprovider. generated xml description file , can verify descriptions in there, here snippet:

    <member name="t:melanite.controllers.collectionscontroller">         <summary>         controller collection related functions         </summary>     </member>     <member name="m:melanite.controllers.collectionscontroller.#ctor">         <summary>         default constructor         </summary>     </member>     <member name="m:melanite.controllers.collectionscontroller.get(system.int32)">         <summary>         collections given center         </summary>         <param name="centerid">the id of center collection belongs to</param>         <returns>a list of collections</returns>     </member>     <member name="m:melanite.controllers.collectionscontroller.get(system.int32,system.datetime)">         <summary>         collections given center on specific date         </summary>         <param name="centerid">the id of center collection belongs to</param>         <param name="date">the planned collection date collections</param>         <returns>a list of collections</returns>     </member> 

i uncommented out lines in helppageconfig this:

// uncomment following use documentation xml documentation file. config.setdocumentationprovider(new xmldocumentationprovider(httpcontext.current.server.mappath("~/app_data/xmldocument.xml"))); 

and made sure xml file in app_data folder. names correct, when run project still no descriptions apiexplorer.

so, can see @ wits end. hope has come across before , knows how fix it. if do, please help!

i have same problem. if added

globalconfiguration.configure(webapiconfig.register)

in startup class (i don't use global.asax) worked properly. hope you, too.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -