webconfig访问denid [英] webconfig access denid

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

问题描述

我搜索但我无法找到解决此问题的方法。当我想保存web.config我收到此错误:



加载配置文件时出错:访问路径'E:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ .ir\httpdocs\egqz2vnh.tmp'被拒绝。



i使用此代码进行访问并保存webconfig:



i search but i cant find a solution for this problem. when i want to save web.config i recieve this error:

An error occurred loading a configuration file: Access to the path 'E:\vhosts\some.ir\httpdocs\egqz2vnh.tmp' is denied.

i use this code for access and save webconfig:

var config = Misconfiguration.OpenWebConfiguration("~");
config.AppSettings.Settings["name"].Value = txt1.Text;

config.Save(ConfigurationSaveMode.Modified);





任何想法?谢谢



any idea? thanks

推荐答案

您有权限问题,需要为您的iis Web应用程序池用户提供读写权限。

检查以下主题

http://forums.asp.net/post/1991662.aspx [< a href =http://forums.asp.net/post/1991662.aspxtarget =_ blanktitle =New Window> ^ ]
you have permission issue and need to give read write access to your iis web application app pool user.
check below thread
http://forums.asp.net/post/1991662.aspx[^]


If您正在使用共享网络托管,您应该可以通过您帐户的控制面板执行此操作。将有一个区域可以设置文件夹和文件的权限。请与您的主机联系以获取此信息。



如果您使用的是VPS或专用服务器,则可以使用远程桌面连接到服务器并以此方式设置权限。



一般来说,将web.config设置为读/写是不太好的做法。如果您需要在应用安装期间设置一个值,则应确保web.config设置为仅在之后读取。
If you are using shared web hosting you should be able to do this through the control panel for your account. There will be an area where you can set permissions for folders and files. Check with your host for this information.

If you are using a VPS or dedicated server you can use remote desktop to connect to the server and set the permissions that way.

Just a general note, it is not really a good practice to set your web.config to read/write. If you need to set a value during an app install you should make sure the web.config is set to read only afterwards.


这篇关于webconfig访问denid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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