Web API (C#) copies files from external directory

Asked

Viewed 115 times

0

I have a Web Api in C# . net framework. In this application I have a method responsible for copying some files to a local directory, where I have my frontend. The problem I’m having is that my web service (once hosted) cannot copy the files from the network directory, which did not happen when the application was local. Is there any configuration I have to do on my IIS server for the files to be copied the same as on the local server? if helping the application does not return error messages while trying to copy the files.

  • 1

    need to see if the user running the application or the application pool in the IIS has access to copy the files

  • From what I saw my application is using Defaultapppool (when I try to use some other error). Is there any possibility of giving her permission?

  • Yes, it is possible. Since Defaultapppool is a local machine account, it would be interesting to add it to a group that has permission, and the machines must be in the same domain.

  • I don’t know if I got it right. Theoretically I would have to give folder permission in my directory for that user? if yes how? because when I try to do it the conventional way it does not find the user.

  • For the websites I use in the company that need to access network folders, we created a separate Applicationpool and put in the identity a domain user who has access to the folder/network server, I think this is the simplest way.

  • then I think I have a problem. Basically none of our servers are in the domain. maybe that’s the problem after all.

  • then for you to access a folder from another machine you must need a user/password that was configured on the other computer right? in this case a mapped drive can help.. the problem is that this mapping exists only for the logged in user, so it may be necessary to map the drive when starting its application in the IIS, in the code

  • I couldn’t solve the problem on my own IIS. The solution I found was to set up a ftp on the server where I search the images and change my web api to look at the ftp.

  • 1

    Got it. Your scenario is very specific, because in general how machines are in the same domain is simpler. I think it was a good solution

Show 4 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.