Swagger not working on Azure web application running OWIN

I have an ASP.NET API implemented as OWIN middleware. I placed it on blue and now I have a problem using swagger. It works fine on localhost, but when I try it on azure, I get the following:

enter image description here

As I made my configuration for swagger in the API, it was to completely delete the SwaggerConfig.cs file and add all the settings to my Startup.cs class, as shown below: How to generate documentation using swashbuckle for WebApi 2 with Owin . If this helps, I am trying to implement oAuth2 between my API, authentication server, and client application.

Can you help me find out what is the reason for misuse of Azure features?

EDIT: I also tried the solution from here , but to no avail. I went to the API tab-> Properties-> Buld-> Changed to 'Release'-> In the output path, the same thing was added as in the "Debug" configuration and nothing.

My bin folder on Azure:

Here you can see that there is an xml resource file

+1
asp.net-web-api azure owin swagger swashbuckle
Sep 09 '16 at 8:09
source share
2 answers

I had this problem when I walked, this tutorial.

In this tutorial number 3 in the section "Configure the middle level to call the data level" I named my key apiAppURL instead of toDoListDataAPIURL . It made me get 500 response codes and

{ "Message": "An error has occurred." } 

in the body of the response.

I fixed it by updating the following line:

 var client = new ApiApp(new Uri(ConfigurationManager.AppSettings["toDoListApiURL"])); 

to

 var client = new ApiApp(new Uri(ConfigurationManager.AppSettings["apiAppURL"])); 

** Made a change to the line at the end of the line. This code can be found in ToDoListController.cs on line 42

Hope this helps someone!

0
Sep 27 '16 at 20:53 on
source share

Check the SwaggerConfig.cs file, if you have not included the XML file with your swagger, it works in your azure application services.

 c.IncludeXmlComments($@"{System.AppDomain.CurrentDomain.BaseDirectory}\bin\WebApiSwagger.XML"); c.DescribeAllEnumsAsStrings(); 

I have included these 2 lines of code to show my xml in swagger, azure grasping will go wrong.

0
Mar 18 '17 at 15:52
source share



All Articles