3

I am using azure for deployment of my new Web API's, I am new with deployment on IIS and azure.

I have added my Web API's on azure as web application, and it's working fine, till I added documentation for each API's functions. After adding description I uncomment line below from HelpPageConfig.cs.

config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));

It's working finr locally, and I am able to see all descriptions, but when I published it on azure, I am getting error saying,

Could not find a part of the path 'D:\home\site\wwwroot\App_Data\XmlDocument.xml'.

site url : http://mejodo.azurewebsites.net/

Do I need to change path ?

File is already created in my system on D:\home\site\wwwroot\App_Data directory.

What changes I need to do to make it work ?

Keval Patel
  • 925
  • 4
  • 24
  • 46

6 Answers6

10

I had the same issue. For me the file was generated. Please follow the below steps.

  1. Click on show all files in solution explorer.
  2. Check whether you have a file in App_Data folder
  3. If you have the file, right click and include the same in your project.
  4. Now build and publish to Azure.

I hope this will work. Thanks

Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140
2

In my case XmlDocument.xml had to be added in Visual Studio to the App_Data folder within the solution using 'add existing item'.

Michael
  • 21
  • 1
1

Just add to your project new folder "App_Data" with XmlDocument.xml and publish

0

When you say that you have Web API's on azure as web application, do you mean that they are applications under the site ? If yes, then I think you are missing the application name in the path to the XML file.

Try going to mejodo.scm.azurewebsites.net > debug console > powershell to see the exact folder structure....

Puneet Gupta
  • 2,237
  • 13
  • 17
0

You must verify that the line in the HelpPageConfig.cs file in the Area>HelpPage>App_Start folder. that is in the register method, this line is

config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));

this uncommented

then you must verify that in the project configuration, in the build XML documentation file, this is the same path as the above mentioned line.

enter image description here

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
JuanDiegoWS
  • 71
  • 1
  • 3
-1

When you publish the xml file goes in the bin folder, so change 'D:\home\site\wwwroot\App_Data\XmlDocument.xml'.

to

'D:\home\site\wwwroot\bin\XmlDocument.xml'.

and it should work.

J3RM
  • 1,702
  • 12
  • 17
  • This is quite unlikely to solve the problem for anyone. You are assuming that the XML document is published to the bin folder, which is not true in my case. For that to be true, the project should be setup to look for that file in the bin folder, but the OP clearly sets the project to place that file in the App_Data folder.. – Kappacake Jun 26 '19 at 14:41