I'm getting an image from a folder on the server, like this;
Image img = Image.FromFile(@"\\192.168.0.12\Folder\image.jpg");
This is an .net core 3.1 application. When I run this on my computer it works fine, I am getting the image. But when ı release this application and run it on the IIS, I am getting this error:
System.IO.FileNotFoundException: \\192.168.0.12\Folder\image.jpg
But definitely there is an image in this path. So how can I solve this problem?
CodePudding user response:
This is probably due to the fact that your local network is different from the server on which the application is published.
Depending on where the server is located, the firewall must be enabled.
With ipconfig
in the command shell you can find out your own IP address and the default gateway.
Therefore it is necessary to find out the remote server IP address and adjust the firewall (open ports).
CodePudding user response:
In the application pool in IIS, I change the identity, from ApplicationPoolIdentity to a custom identity who can access the local server. Then the application, accessed the folders I want.