tsql

https://blog.csdn.net/a497785609/article/details/49952281

写了一个类IISAdmin,负责建立、设置、删除虚拟目录,发现在web中调用,遇到权限问题,解决方法如下(转载):

 下面代码在ASP.NET中,会因权限问题被拒绝访问。 

 

以下为引用的内容:
System.DirectoryServices.DirectoryEntry directoryEntry; 
directoryEntry = new System.DirectoryServices.DirectoryEntry("IIS://localhost/w3svc/1"); 
directoryEntry.Invoke("Start", new object[] { }); 错误:拒绝访问。 
异常详细信息: System.UnauthorizedAccessException: 拒绝访问。 解决方法 
修改web.config文件 
<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.web> 
       <identity impersonate="true" userName="administrator" password="1q2w3e4r"/> 
    </system.web> 
</configuration>

 

 在ASP.NET里面使用COM对象的时候,会被拒绝访问。

 可以在web.config里面添加下面代码解决

 

以下为引用的内容:
<identity impersonate="true" userName="username" password="password"/>

分类:

技术点:

相关文章:

  • 2021-08-16
  • 2021-11-14
  • 2021-04-13
  • 2021-04-07
  • 2021-11-24
  • 2021-07-24
  • 2021-12-26
  • 2021-06-09
猜你喜欢
  • 2021-12-06
  • 2021-10-15
  • 2021-11-14
  • 2021-09-14
  • 2021-10-05
  • 2021-09-14
相关资源
相似解决方案