0

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

Dharman
  • 30,962
  • 25
  • 85
  • 135
AwadhJY
  • 1
  • 2
  • You don't really want to do that... that is only where the pages/routing would be.... SQL server just requires changing the connection string... for storing files you'd just copy them to the UNC path (careful here... keep permissions limited...) Though I may have misunderstood? This statement is sort of contradictory: "all servers linked in local network , IIS server connected to the internet only." – pcalkins Mar 15 '23 at 18:41
  • 1
    @pcalkins you can check my last edit on the question – AwadhJY Mar 15 '23 at 21:34
  • Nice. Still I wouldn't serve files directly like that. Let the back-end serve the file in the response. (so you can be sure to check authorization, and/or prevent "deep-links") – pcalkins Mar 15 '23 at 21:46
  • 2
    Please do not edit solution announcements into the question or title. See [What should I do when someone answers my question?](https://stackoverflow.com/help/someone-answers) You can also create your own answer, and even accept it, if your solution is not yet covered by an existing answer. See [Can I answer my own question?](https://stackoverflow.com/help/self-answer) – jmoerdyk Mar 20 '23 at 18:31

1 Answers1

-1

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

AwadhJY
  • 1
  • 2