简体   繁体   English

在休息服务中拒绝访问路径C:\\

[英]Access to the path C:\ is denied in rest service

I have developed restful service such a way that it gets the data from share point site in json format and creates FormatedProductDetail.json file in drive C:\\inetpub\\ProductSelector 我已经开发了一种宁静的服务,可以从共享站点以json格式获取数据,并在驱动器C:\\ inetpub \\ ProductSelector中创建FormatedProductDetail.json文件。

Below is the code to create a json file in c drive. 下面是在c驱动器中创建json文件的代码。

string Jsondata = serialize.Serialize(serviceResponse);
using (WebClient myWebClient = new WebClient())
{    
    myWebClient.UploadString(ConfigurationManager.AppSettings["outputFilePath"], Jsondata);   
}

below is the code from web.config 以下是来自web.config的代码

<appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
    <add key="inputFilePath" value="~/products.json"/>
    <!--<add key="outputFilePath" value="C:\FormatedProductDetail.txt"/>-->
    <add key="outputFilePath" value="C:\inetpub\ProductSelector\FormatedProductDetail.json"/>
</appSettings>

I have access only for C:\\inetpub\\ProductSelector but not c:\\ but still I am getting the error from postman as 我只能访问C:\\ inetpub \\ ProductSelector,但不能访问c:\\,但是仍然从邮递员那里收到错误

Access to the path 'C:\\inetpub\\ProductSelector\\FormatedProductDetail.json' is denied. 拒绝访问路径“ C:\\ inetpub \\ ProductSelector \\ FormatedProductDetail.json”。

IIS应用程序池用户帐户需要访问该文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM