Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to grant write permissions to an web api application in IIS?

I simply have a web api application on IIS server that simply writes to text file on C:\FileStorage\test.txt however when I call this webservice I get the internal 500 error, after expanding the error,I get the following error, how do I grant write access to this web service on IIS server?

"ExceptionMessage": "Access to the path 'C:\\FileStorage\\test.txt' is denied.",
"ExceptionType": "System.UnauthorizedAccessException",
"StackTrace": "   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n   at 
like image 451
user1429595 Avatar asked Jun 05 '13 19:06

user1429595


1 Answers

Grant permissions for that folder to the application pool. So you'd go to the C:\FileStorage folder in Windows and edit permissions, and add IIS APPPOOL\appPoolNameHere as a user, then give it full permissions.

Hope that helps.

EDIT

Step by Step Instructions...

-Open Windows Explorer

-Browse to your folder

-Right click the folder and go to Properties

-On the Security tab click Edit

-Click Add

-Under Locations, make sure it is pointing at your local machine, not a domain

-For the object name, enter below but replace MyAppPool with the name of your application pool...

IIS APPPOOL\MyAppPool

-Set the permissions to Full, or just add Write, or whatever you need.

like image 122
Jim Avatar answered Sep 20 '22 02:09

Jim