1

I want to deploy my C# API project in Microsoft Azure.

I've changed my wwwroot folder name to "Documents" like:

public static void Main(string[] args)
{
    var host = new WebHostBuilder()
        .UseKestrel()
        .UseWebRoot("Documents")
        .UseContentRoot(Directory.GetCurrentDirectory())
        .UseIISIntegration()
        .UseStartup<MyStartup>()
        .Build();

    host.Run();
}

It is working perfectly using POSTMAN or local server but when I'm accessing it with Microsoft Azure, It is showing error of not finding the above mentioned folder. How can I get it in Azure?

M A K
  • 432
  • 2
  • 5
  • 18
  • 1
    Azure app service or VM? You can use the Kudu console to see the filesystem of an app service. – Crowcoder Jan 30 '19 at 12:08
  • `UseWebRoot` won't create a new directory. `UseWebRoot("Documents")` says the site will use a `Documents` folder in its current working directory. Does that folder exist? – Panagiotis Kanavos Jan 30 '19 at 14:46
  • I'm using it in Azure App, and above code is just an example, The directory I've made does exist and it working perfectly in IIS but not in Azure. – M A K Jan 31 '19 at 09:14
  • How did you change the name? I tried to change wwwroot to documents, but the Kudu will re-create a wwwroot folder. – George Chen Jan 31 '19 at 09:37
  • In Visual Studio I use above mentioned code with some modification according to my need. It is working on IIS and on my local server but it is not working in Azure. It is not finding the path. – M A K Jan 31 '19 at 10:24

1 Answers1

1

In Azure you have to go to Application setting and edit the path according to your requirements. Picture is attached for guidance.

M A K
  • 432
  • 2
  • 5
  • 18