如何授予写权限在IIS中的Web API应用程序?应用程序、权限、Web、IIS

2023-09-04 01:00:17 作者:謌丶依旧潇洒

我只是有IIS服务器上的Web API应用程序,简单地写入到文本文件在C:\ FileStorage \ test.txt的但是当我把这个web服务,我得到了500内部错误,扩展错误之后,我得到以下错误,我怎么允许写入访问到IIS服务器上的此Web服务?

 ExceptionMessage:访问路径C:\\ FileStorage \\ test.txt的被拒绝。
ExceptionType:System.UnauthorizedAccessException的,
堆栈跟踪:在System.IO .__ Error.WinIOError(的Int32错误code,字符串maybeFullPath)\ r \ n将在
 

解决方案

该文件夹的应用程序池授予权限。所以,你会去到C:\ FileStorage文件夹在Windows和编辑权限,并添加IIS APPPOOL \ appPoolNameHere作为一个用户,然后给它充分的权限

希望有所帮助。

修改的

分步说明...

- 开放Windows资源管理器

-browse到你的文件夹

- 右单击该文件夹并选择属性。

-On安全选项卡上单击编辑

- 单击添加

- 下层位置,确保它指向本地计算机,而不是域

- 对于对象的名称,下面进入,但你的应用程序池的名称替换MyAppPool ...

IIS APPPOOL \ MyAppPool

- 设置权限为完全,或只加写,或任何你需要的。

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 
IIS6.0 IIS7.5应用程序池自动停止的解决方法

解决方案

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.