写入IIS上的文件 [英] Write to a file on IIS

查看:129
本文介绍了写入IIS上的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个mvc3应用程序,我想写入文件但不知道如何。

IIS不允许StreamWriter file = new StreamWriter(Environment.CurrentDirectory);

如何写文件?

I have an mvc3 app which I want to write to a file but don't know how.
IIS doesn't allow StreamWriter file = new StreamWriter(Environment.CurrentDirectory);
How do I go about writing to a file?

推荐答案


IIS不允许StreamWriter file = new StreamWriter(Environment.CurrentDirectory);

IIS doesn't allow StreamWriter file = new StreamWriter(Environment.CurrentDirectory);

IIS允许一切。您运行应用程序的帐户可能没有写入此目录的权限。因此,您需要做的就是将此帐户的写入权限授予指定目录。或者,您可以写入您的应用程序的〜/ App_Data 文件夹,该文件可能有权获得该帐户。

IIS allows everything. The account you are running your application under probably doesn't have permissions to write to this directory. So all you need to do is grant write permissions to this account to the specified directory. Alternatively you could write to the ~/App_Data folder of your application where chances are that the account will have permission.

这篇关于写入IIS上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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