如何授予写权限在IIS中的Web API应用程序? [英] how to grant write permissions to an web api application in IIS?

查看:620
本文介绍了如何授予写权限在IIS中的Web API应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是有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 

解决方案

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.

这篇关于如何授予写权限在IIS中的Web API应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆