.netasp.net-corewwwroot

how can I change asp.net core 6 wwwroot folder path to another server


I'm facing this situation, the customer wants to set the IIS on server , SQL Server on other server and uploaded files on other server. all servers linked in local network , IIS server connected to the internet only.

so how can I change asp.net core 6 wwwroot folder path to another server?

I tried to set shortcut of a network folder in the wwwroot but it's look like a .link not a folder


Solution

  • to solved this issue add:

        app.UseStaticFiles(new StaticFileOptions()
    {
        FileProvider = new PhysicalFileProvider("\\\\192.168.1.234\\Arc\\Uploaded\\"),
         
    });
    

    this work fine in debug mode, in publish gives this error:

    HTTP Error 500.30 - ASP.NET Core app failed to start

    to solve it add account in IIS:

    1. Open the IIS Management
    2. Open the Application Pools ->Select the application pool you want to change
    3. Right click the application pool and select Advanced Settings
    4. Select the Identity list item and click the ellipsis (the button with the three dots)
    5. Select the custom account -> set...
    6. insert user name: <machinename> and related password
    7. ok , ok ,ok ...

    Steps to add account