Last post May 30, 2019 02:01 AM by Ackerly Xu
May 29, 2019 10:37 AM|abhis_412|LINK
I have an application hosted in IIS server and it executes a batch file. The batch file contains few CMD command such as mkdir, xcopy etc. When I run the same application from Visual Studio, it copies all the files inside the new folder successfully. When
I try to run the same application from IIS, it ends without throwing any error. The authentication used in the application is Windows and it is configured inside config file.
So, below are the point of concerns:
Thanks in advance.
May 29, 2019 12:09 PM|mgebhard|LINK
While running the application, which user helps to authenticate the folder access, is that IIS user or the current user?
An IIS application runs under application pool identity not the current user.
Is that access related issue or any other configuration related?
This is an access issue as the application pool does not have access to the network share.
What is the preferable solution?
The solution depends on your requirements. I generally set the application pool identity to a service account. Then grant access rights to the service account.
May 29, 2019 12:12 PM|PatriceSc|LINK
Likely a permission problem. AFAIK \\server\drive$ is only available to admin accounts. It would be likely better to create your own share with the needed permissions rather than trying to access a full drive.
More likely you could see an error if redirecting the batch file output to a trace file.
May 29, 2019 12:32 PM|abhis_412|LINK
Thank you! That was really helpful.
May 30, 2019 02:01 AM|Ackerly Xu|LINK
You could change the application pool's identity to local system to check whether it is a permission problem, because local system has similar permission as administrator.
About how to change application pool's identity to local system, you could refer to
If after you have changed to local system , the problem is solved, the problem may have something to do with permission.
Then you could add permission of all the related folder to your application pool user and reset your application pool's identity to ApplicationPoolIdentity( give application pool too mush permission is not suitable).
About application pool and file system's permission and how to change the permission, please refer to
In addition, from your title, you are going to copy files to remote directory, please ensure your iis server has network connection to remote server.