Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
366 views
in Technique[技术] by (71.8m points)

c# - 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:FileStorageest.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)
   at 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 APPPOOLappPoolNameHere 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 APPPOOLMyAppPool

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...